Remote camera and user validation

Support and queries relating to all previous versions of ZoneMinder
Locked
pmeyland
Posts: 9
Joined: Fri Nov 28, 2003 11:36 am

Remote camera and user validation

Post by pmeyland »

Hi

I've a big problem with my remote camera. It requires a username and password, before I can access the picture.

In the doc under Remote Host/Port/Path I have read that I could write username:password@hostname but when I do that I can see an error i zmpkg.log saying Bogus argument 'username:password@hostname' found at /usr/local/bin/zmdc.pl line 118.

I'm using ZoneMinder 0.9.15

Kind regards

Peter
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Remote camera and user validation

Post by zoneminder »

Hi Peter,

Yes, this does seem to be broken. I'll try and set my current camera up with a username/password and reproduce the problem then get out a patch to fix it.

Phil,
steltek
Posts: 11
Joined: Fri Feb 20, 2004 1:23 pm

Re: Remote camera and user validation

Post by steltek »

It looks like this is still broken.

Doing zmc -H user:pass@10.10.10.10 -P 80 -p /jpg/fullsize.jpg

results in:

ERR [Can't gethostbyname(user:pass@10.10.10.10): Operation not permitted]

Ie somehow zmc doesn't split the part in front of the @ off of the hostname/address.
steltek
Posts: 11
Joined: Fri Feb 20, 2004 1:23 pm

Re: Remote camera and user validation

Post by steltek »

Poking around a little, I guess you need to split the hostname, username and password fields to get it to work.

From the RFC: (ftp://ftp.isi.edu/in-notes/rfc2617.txt)

To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64 [7] encoded string in the credentials.

An example of such a header (Username 'Aladdin' and password 'open sesame'):
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

So basically you need $hostname, $username, $password, then you do $base64 = base64($username.":".$password) and then connect to hostname and within the headers (right after the GET) send "Authorization: Basic $base64" (note: if I knew C/C++ I could write this, my example here is PHP).

You can also detect when authentication failed when you get the response from the server, see here for an example: http://216.239.41.104/search?q=cache:rr ... n&ie=UTF-8
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Remote camera and user validation

Post by zoneminder »

Hi Michel,

Yes this functionality was missing. However the good news is that I've already put it into v1.18.0 which will be out in the next couple of days (once I've finished updating the docs).

Cheers,

Phil,
Locked