-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add options to use GetSystemDateAndTime
to fix Created
field in UsernameToken
#121
Comments
I'm not sure I like the idea; usually cameras and devices should be running at the same time. ONVIF cameras uses NTP to resync and so should your computer. I haven't dug deep into the protocol so it may be fine, but it smells like an attack vector |
It's possible that time of camera or PC is not correct, depends on the end user. For example, we have some cameras, configged with NTP. Then the end user use my app to control the cameras, while the time of PC is not correct. The only way to let the app work is force the user to change time of the PC, I think this is not good. In many use cases, the devices work in LAN, not connect to Internet, and the user don't config NTP. So every device may have different time. |
By ONVIF dev guide, the process is following:
It's hard to make it work right without NTP. In that case, the client may set the camera's time with |
So then in that case it's a non-issue; the API code should just be used differently. Do you happen to know what's "too big" of a time difference? Is it specified? |
Here they recommend to reject everything with >5min diff:
|
I still don't believe this is the responsibility of the library to handle. The caller should perform the sync using the library. We could however add a function to handle it all, but I would oppose to it being use automatically. |
Agreed. The library should give choice to the developer, and the auto-fix-time feature should be disabled by default. |
I can look into adding that. I'll put it on my tab. |
I found my program can't connect to a camera with error "NotAuthorized", while it was OK some time ago and I did not change my code. Then I try ONVIF Device Manager, it could work.
I finally found that the problem is time difference: camera's time is 20 seconds differ from my pc time. I reset the camera time and the program could work. However, ONVIF Device Manager works well even if I don't change the camera's time.
The picture shows what ONVIF Device Manager do: it use the camera's time, instead of pc time, to create the token.
So, I suggest to add a option that could use a fixed time to create the
Created
field inUsernameToken
.That could be done by querying with the
GetSystemDateAndTime
command, and store the difference between camera and PC asDuration
. TheDuration
may be added to theCreated
field when making theUsernameToken
everytime.The text was updated successfully, but these errors were encountered: