diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-02-13 16:35:48 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-02-13 16:35:48 +0000 |
commit | 12f89d241ce15358fb71ef1b1249803ee9d97374 (patch) | |
tree | e4d30c1cef3c83b1f816ce482592c96a21daa4b3 /backend/snmp.c | |
parent | dcb445bcf3e9ec2efd56550263052aca70beb08e (diff) | |
download | cups-12f89d241ce15358fb71ef1b1249803ee9d97374.tar.gz |
Merge changes from CUPS 1.6svn-r10267.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3643 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'backend/snmp.c')
-rw-r--r-- | backend/snmp.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/backend/snmp.c b/backend/snmp.c index 08ee25e2a..745c5d8fd 100644 --- a/backend/snmp.c +++ b/backend/snmp.c @@ -3,7 +3,7 @@ * * SNMP discovery backend for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 2006-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1112,12 +1112,18 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */ case DEVICE_URI : if (device && packet.object_type == CUPS_ASN1_OCTET_STRING && - !device->uri && packet.object_value.string.num_bytes > 0) + !device->uri && packet.object_value.string.num_bytes > 3) { /* * Update an existing cache entry... */ + char scheme[32], /* URI scheme */ + userpass[256], /* Username:password in URI */ + hostname[256], /* Hostname in URI */ + resource[1024]; /* Resource path in URI */ + int port; /* Port number in URI */ + if (!strncmp((char *)packet.object_value.string.bytes, "lpr:", 4)) { /* @@ -1127,7 +1133,13 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */ packet.object_value.string.bytes[2] = 'd'; } - device->uri = strdup((char *)packet.object_value.string.bytes); + if (httpSeparateURI(HTTP_URI_CODING_ALL, + (char *)packet.object_value.string.bytes, + scheme, sizeof(scheme), + userpass, sizeof(userpass), + hostname, sizeof(hostname), &port, + resource, sizeof(resource)) >= HTTP_URI_OK) + device->uri = strdup((char *)packet.object_value.string.bytes); } break; } |