diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-01-17 00:06:33 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-01-17 00:06:33 +0000 |
commit | 91c84a3551145559de2956179661e111e373db95 (patch) | |
tree | ea061b2b6ab3b9e4530347e35f5cde3511f8a305 /cups | |
parent | 080811b190031b9182e96dc76fc610fadfeaec21 (diff) | |
download | cups-91c84a3551145559de2956179661e111e373db95.tar.gz |
Import CUPS 1.4svn-r7226.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@582 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups')
-rw-r--r-- | cups/Dependencies | 660 | ||||
-rw-r--r-- | cups/Makefile | 22 | ||||
-rw-r--r-- | cups/auth.c | 2 | ||||
-rw-r--r-- | cups/dest.c | 10 | ||||
-rw-r--r-- | cups/emit.c | 26 | ||||
-rw-r--r-- | cups/encode.c | 40 | ||||
-rw-r--r-- | cups/globals.h | 5 | ||||
-rw-r--r-- | cups/http-addrlist.c | 10 | ||||
-rw-r--r-- | cups/http.c | 16 | ||||
-rw-r--r-- | cups/ipp.c | 24 | ||||
-rw-r--r-- | cups/language.c | 15 | ||||
-rw-r--r-- | cups/libcups.exp | 8 | ||||
-rw-r--r-- | cups/options.c | 17 | ||||
-rw-r--r-- | cups/ppd.c | 23 | ||||
-rw-r--r-- | cups/snmp.c | 1268 | ||||
-rw-r--r-- | cups/snmp.h | 121 | ||||
-rw-r--r-- | cups/testcups.c | 1 | ||||
-rw-r--r-- | cups/testsnmp.c | 224 | ||||
-rw-r--r-- | cups/transcode.c | 20 | ||||
-rw-r--r-- | cups/util.c | 6 |
20 files changed, 2134 insertions, 384 deletions
diff --git a/cups/Dependencies b/cups/Dependencies index 167b8b5ae..3e54079d5 100644 --- a/cups/Dependencies +++ b/cups/Dependencies @@ -1,324 +1,336 @@ -# DO NOT DELETE THIS LINE -- make depend depends on it. -adminutil.o: adminutil.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h globals.h string.h \ - http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h -array.o: array.c array.h string.h ../config.h string.h debug.h -attr.o: attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h -auth.o: auth.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -backchannel.o: backchannel.c cups.h ipp.h http.h string.h ../config.h \ - ppd.h array.h file.h language.h -backend.o: backend.c backend.h string.h ../config.h string.h -custom.o: custom.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -dest.o: dest.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -dir.o: dir.c dir.h string.h ../config.h string.h debug.h -emit.o: emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h -encode.o: encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h ipp-private.h string.h debug.h -file.o: file.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -getifaddrs.o: getifaddrs.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h -getputfile.o: getputfile.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - string.h debug.h -globals.o: globals.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http.o: http.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http-addr.o: http-addr.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -http-addrlist.o: http-addrlist.c http-private.h ../config.h http.h \ - string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h debug.h -http-support.o: http-support.c debug.h globals.h string.h ../config.h \ - string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h -ipp.o: ipp.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -ipp-support.o: ipp-support.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -langprintf.o: langprintf.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h -language.o: language.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -localize.o: localize.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -mark.o: mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h string.h debug.h -md5.o: md5.c md5.h string.h ../config.h string.h -md5passwd.o: md5passwd.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h string.h -notify.o: notify.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -options.o: options.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h string.h debug.h -page.o: page.c ppd.h array.h file.h string.h ../config.h string.h -ppd.o: ppd.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -request.o: request.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -sidechannel.o: sidechannel.c sidechannel.h string.h ../config.h string.h -snprintf.o: snprintf.c string.h ../config.h string.h -string.o: string.c array.h debug.h string.h ../config.h string.h -tempfile.o: tempfile.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -transcode.o: transcode.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -usersys.o: usersys.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -util.o: util.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -testadmin.o: testadmin.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h string.h -testarray.o: testarray.c ../cups/string.h ../config.h string.h array.h \ - dir.h debug.h -testcups.o: testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h -testfile.o: testfile.c string.h ../config.h string.h file.h debug.h -testhttp.o: testhttp.c http.h string.h ../config.h string.h -testi18n.o: testi18n.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testipp.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h \ - ipp.h http.h -testlang.o: testlang.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testppd.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \ - file.h -# DO NOT DELETE THIS LINE -- make depend depends on it. -adminutil.32.o: adminutil.c adminutil.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h globals.h string.h \ - http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h -array.32.o: array.c array.c array.h string.h ../config.h string.h debug.h -attr.32.o: attr.c attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h -auth.32.o: auth.c auth.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -backchannel.32.o: backchannel.c backchannel.c cups.h ipp.h http.h string.h ../config.h \ - ppd.h array.h file.h language.h -backend.32.o: backend.c backend.c backend.h string.h ../config.h string.h -custom.32.o: custom.c custom.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -dest.32.o: dest.c dest.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -dir.32.o: dir.c dir.c dir.h string.h ../config.h string.h debug.h -emit.32.o: emit.c emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h -encode.32.o: encode.c encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h ipp-private.h string.h debug.h -file.32.o: file.c file.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -getifaddrs.32.o: getifaddrs.c getifaddrs.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h -getputfile.32.o: getputfile.c getputfile.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - string.h debug.h -globals.32.o: globals.c globals.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http.32.o: http.c http.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http-addr.32.o: http-addr.c http-addr.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -http-addrlist.32.o: http-addrlist.c http-addrlist.c http-private.h ../config.h http.h \ - string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h debug.h -http-support.32.o: http-support.c http-support.c debug.h globals.h string.h ../config.h \ - string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h -ipp.32.o: ipp.c ipp.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -ipp-support.32.o: ipp-support.c ipp-support.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -langprintf.32.o: langprintf.c langprintf.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h -language.32.o: language.c language.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -localize.32.o: localize.c localize.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -mark.32.o: mark.c mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h string.h debug.h -md5.32.o: md5.c md5.c md5.h string.h ../config.h string.h -md5passwd.32.o: md5passwd.c md5passwd.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h string.h -notify.32.o: notify.c notify.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -options.32.o: options.c options.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h string.h debug.h -page.32.o: page.c page.c ppd.h array.h file.h string.h ../config.h string.h -ppd.32.o: ppd.c ppd.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -request.32.o: request.c request.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -sidechannel.32.o: sidechannel.c sidechannel.c sidechannel.h string.h ../config.h string.h -snprintf.32.o: snprintf.c snprintf.c string.h ../config.h string.h -string.32.o: string.c string.c array.h debug.h string.h ../config.h string.h -tempfile.32.o: tempfile.c tempfile.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -transcode.32.o: transcode.c transcode.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -usersys.32.o: usersys.c usersys.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -util.32.o: util.c util.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -testadmin.32.o: testadmin.c testadmin.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h string.h -testarray.32.o: testarray.c testarray.c ../cups/string.h ../config.h string.h array.h \ - dir.h debug.h -testcups.32.o: testcups.c testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h -testfile.32.o: testfile.c testfile.c string.h ../config.h string.h file.h debug.h -testhttp.32.o: testhttp.c testhttp.c http.h string.h ../config.h string.h -testi18n.32.o: testi18n.c testi18n.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testipp.32.o: testipp.c testipp.c ../cups/string.h ../config.h string.h ipp-private.h \ - ipp.h http.h -testlang.32.o: testlang.c testlang.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testppd.32.o: testppd.c testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \ - file.h -# DO NOT DELETE THIS LINE -- make depend depends on it. -adminutil.64.o: adminutil.c adminutil.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h globals.h string.h \ - http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h -array.64.o: array.c array.c array.h string.h ../config.h string.h debug.h -attr.64.o: attr.c attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h -auth.64.o: auth.c auth.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -backchannel.64.o: backchannel.c backchannel.c cups.h ipp.h http.h string.h ../config.h \ - ppd.h array.h file.h language.h -backend.64.o: backend.c backend.c backend.h string.h ../config.h string.h -custom.64.o: custom.c custom.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -dest.64.o: dest.c dest.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -dir.64.o: dir.c dir.c dir.h string.h ../config.h string.h debug.h -emit.64.o: emit.c emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h -encode.64.o: encode.c encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h ipp-private.h string.h debug.h -file.64.o: file.c file.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -getifaddrs.64.o: getifaddrs.c getifaddrs.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h -getputfile.64.o: getputfile.c getputfile.c http-private.h ../config.h http.h string.h \ - md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - string.h debug.h -globals.64.o: globals.c globals.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http.64.o: http.c http.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -http-addr.64.o: http-addr.c http-addr.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -http-addrlist.64.o: http-addrlist.c http-addrlist.c http-private.h ../config.h http.h \ - string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h debug.h -http-support.64.o: http-support.c http-support.c debug.h globals.h string.h ../config.h \ - string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \ - array.h file.h language.h i18n.h transcode.h -ipp.64.o: ipp.c ipp.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -ipp-support.64.o: ipp-support.c ipp-support.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -langprintf.64.o: langprintf.c langprintf.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h -language.64.o: language.c language.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -localize.64.o: localize.c localize.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -mark.64.o: mark.c mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \ - file.h language.h string.h debug.h -md5.64.o: md5.c md5.c md5.h string.h ../config.h string.h -md5passwd.64.o: md5passwd.c md5passwd.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h string.h -notify.64.o: notify.c notify.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h -options.64.o: options.c options.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h string.h debug.h -page.64.o: page.c page.c ppd.h array.h file.h string.h ../config.h string.h -ppd.64.o: ppd.c ppd.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -request.64.o: request.c request.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -sidechannel.64.o: sidechannel.c sidechannel.c sidechannel.h string.h ../config.h string.h -snprintf.64.o: snprintf.c snprintf.c string.h ../config.h string.h -string.64.o: string.c string.c array.h debug.h string.h ../config.h string.h -tempfile.64.o: tempfile.c tempfile.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -transcode.64.o: transcode.c transcode.c globals.h string.h ../config.h string.h \ - http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \ - file.h language.h i18n.h transcode.h debug.h -usersys.64.o: usersys.c usersys.c http-private.h ../config.h http.h string.h md5.h \ - ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \ - language.h i18n.h transcode.h debug.h -util.64.o: util.c util.c globals.h string.h ../config.h string.h http-private.h \ - http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \ - i18n.h transcode.h debug.h -testadmin.64.o: testadmin.c testadmin.c adminutil.h cups.h ipp.h http.h string.h \ - ../config.h ppd.h array.h file.h language.h string.h -testarray.64.o: testarray.c testarray.c ../cups/string.h ../config.h string.h array.h \ - dir.h debug.h -testcups.64.o: testcups.c testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \ - array.h file.h language.h -testfile.64.o: testfile.c testfile.c string.h ../config.h string.h file.h debug.h -testhttp.64.o: testhttp.c testhttp.c http.h string.h ../config.h string.h -testi18n.64.o: testi18n.c testi18n.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testipp.64.o: testipp.c testipp.c ../cups/string.h ../config.h string.h ipp-private.h \ - ipp.h http.h -testlang.64.o: testlang.c testlang.c i18n.h transcode.h language.h array.h string.h \ - ../config.h string.h -testppd.64.o: testppd.c testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \ - file.h +# DO NOT DELETE + +adminutil.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +adminutil.o: file.h language.h globals.h string.h ../config.h http-private.h +adminutil.o: md5.h ipp-private.h i18n.h transcode.h debug.h +array.o: array.h versioning.h string.h ../config.h debug.h +attr.o: ppd.h array.h versioning.h file.h debug.h string.h ../config.h +auth.o: globals.h string.h ../config.h http-private.h http.h versioning.h +auth.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +auth.o: i18n.h transcode.h debug.h +backchannel.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h +backchannel.o: language.h +backend.o: backend.h versioning.h string.h ../config.h +custom.o: globals.h string.h ../config.h http-private.h http.h versioning.h +custom.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +custom.o: i18n.h transcode.h debug.h +dest.o: debug.h globals.h string.h ../config.h http-private.h http.h +dest.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h +dest.o: language.h i18n.h transcode.h +dir.o: dir.h versioning.h string.h ../config.h debug.h +emit.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h +encode.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +encode.o: ipp-private.h string.h ../config.h debug.h +file.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +file.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +file.o: i18n.h transcode.h debug.h +getifaddrs.o: http-private.h ../config.h http.h versioning.h md5.h +getifaddrs.o: ipp-private.h ipp.h +getputfile.o: globals.h string.h ../config.h http-private.h http.h +getputfile.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +getputfile.o: file.h language.h i18n.h transcode.h debug.h +globals.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +globals.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +globals.o: i18n.h transcode.h debug.h +http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +http.o: i18n.h transcode.h debug.h +http-addr.o: globals.h string.h ../config.h http-private.h http.h +http-addr.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-addr.o: file.h language.h i18n.h transcode.h debug.h +http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h +http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h +http-addrlist.o: file.h language.h i18n.h transcode.h debug.h +http-support.o: debug.h globals.h string.h ../config.h http-private.h http.h +http-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-support.o: file.h language.h i18n.h transcode.h +ipp.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +ipp.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h +ipp.o: transcode.h debug.h +ipp-support.o: globals.h string.h ../config.h http-private.h http.h +ipp-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +ipp-support.o: file.h language.h i18n.h transcode.h debug.h +langprintf.o: globals.h string.h ../config.h http-private.h http.h +langprintf.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +langprintf.o: file.h language.h i18n.h transcode.h +language.o: globals.h string.h ../config.h http-private.h http.h versioning.h +language.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +language.o: i18n.h transcode.h debug.h +localize.o: globals.h string.h ../config.h http-private.h http.h versioning.h +localize.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +localize.o: i18n.h transcode.h debug.h +mark.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +mark.o: string.h ../config.h debug.h +md5.o: md5.h string.h ../config.h +md5passwd.o: http-private.h ../config.h http.h versioning.h md5.h +md5passwd.o: ipp-private.h ipp.h string.h +notify.o: globals.h string.h ../config.h http-private.h http.h versioning.h +notify.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +notify.o: i18n.h transcode.h +options.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +options.o: string.h ../config.h debug.h +page.o: ppd.h array.h versioning.h file.h string.h ../config.h +ppd.o: globals.h string.h ../config.h http-private.h http.h versioning.h +ppd.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +ppd.o: i18n.h transcode.h debug.h +request.o: globals.h string.h ../config.h http-private.h http.h versioning.h +request.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +request.o: i18n.h transcode.h debug.h +sidechannel.o: sidechannel.h versioning.h string.h ../config.h +snmp.o: globals.h string.h ../config.h http-private.h http.h versioning.h +snmp.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +snmp.o: i18n.h transcode.h snmp.h +snprintf.o: string.h ../config.h +string.o: array.h versioning.h debug.h string.h ../config.h +tempfile.o: globals.h string.h ../config.h http-private.h http.h versioning.h +tempfile.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +tempfile.o: i18n.h transcode.h debug.h +transcode.o: globals.h string.h ../config.h http-private.h http.h +transcode.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +transcode.o: file.h language.h i18n.h transcode.h debug.h +usersys.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +usersys.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +usersys.o: i18n.h transcode.h debug.h +util.o: globals.h string.h ../config.h http-private.h http.h versioning.h +util.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +util.o: i18n.h transcode.h debug.h +testadmin.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +testadmin.o: file.h language.h string.h ../config.h +testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h +testarray.o: debug.h +testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +testfile.o: string.h ../config.h file.h versioning.h debug.h +testhttp.o: http.h versioning.h string.h ../config.h +testi18n.o: i18n.h transcode.h language.h array.h versioning.h string.h +testi18n.o: ../config.h +testipp.o: ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h +testipp.o: versioning.h +testlang.o: i18n.h transcode.h language.h array.h versioning.h string.h +testlang.o: ../config.h +testppd.o: ../cups/string.h ../config.h string.h ppd.h array.h versioning.h +testppd.o: file.h +testsnmp.o: string.h ../config.h snmp.h http.h versioning.h +# DO NOT DELETE + +adminutil.32.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +adminutil.32.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h +adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h +array.32.o: array.c array.h versioning.h string.h ../config.h debug.h +attr.32.o: attr.c ppd.h array.h versioning.h file.h debug.h string.h ../config.h +auth.32.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h +auth.32.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +auth.32.o: auth.c i18n.h transcode.h debug.h +backchannel.32.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h +backchannel.32.o: backchannel.c language.h +backend.32.o: backend.c backend.h versioning.h string.h ../config.h +custom.32.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h +custom.32.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +custom.32.o: custom.c i18n.h transcode.h debug.h +dest.32.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h +dest.32.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h +dest.32.o: dest.c language.h i18n.h transcode.h +dir.32.o: dir.c dir.h versioning.h string.h ../config.h debug.h +emit.32.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h +encode.32.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h +file.32.o: file.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +file.32.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +file.32.o: file.c i18n.h transcode.h debug.h +getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h +getifaddrs.32.o: getifaddrs.c ipp-private.h ipp.h +getputfile.32.o: getputfile.c globals.h string.h ../config.h http-private.h http.h +getputfile.32.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h debug.h +globals.32.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +globals.32.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +globals.32.o: globals.c i18n.h transcode.h debug.h +http.32.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +http.32.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +http.32.o: http.c i18n.h transcode.h debug.h +http-addr.32.o: http-addr.c globals.h string.h ../config.h http-private.h http.h +http-addr.32.o: http-addr.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h debug.h +http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h +http-addrlist.32.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h +http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h +http-support.32.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h +http-support.32.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-support.32.o: http-support.c file.h language.h i18n.h transcode.h +ipp.32.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +ipp.32.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h +ipp.32.o: ipp.c transcode.h debug.h +ipp-support.32.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h +ipp-support.32.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h +langprintf.32.o: langprintf.c globals.h string.h ../config.h http-private.h http.h +langprintf.32.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h +language.32.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h +language.32.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +language.32.o: language.c i18n.h transcode.h debug.h +localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h +localize.32.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +localize.32.o: localize.c i18n.h transcode.h debug.h +mark.32.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +mark.32.o: mark.c string.h ../config.h debug.h +md5.32.o: md5.c md5.h string.h ../config.h +md5passwd.32.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h +md5passwd.32.o: md5passwd.c ipp-private.h ipp.h string.h +notify.32.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h +notify.32.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +notify.32.o: notify.c i18n.h transcode.h +options.32.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +options.32.o: options.c string.h ../config.h debug.h +page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h +ppd.32.o: ppd.c globals.h string.h ../config.h http-private.h http.h versioning.h +ppd.32.o: ppd.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +ppd.32.o: ppd.c i18n.h transcode.h debug.h +request.32.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h +request.32.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +request.32.o: request.c i18n.h transcode.h debug.h +sidechannel.32.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h +snmp.32.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h +snmp.32.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +snmp.32.o: snmp.c i18n.h transcode.h snmp.h +snprintf.32.o: snprintf.c string.h ../config.h +string.32.o: string.c array.h versioning.h debug.h string.h ../config.h +tempfile.32.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h +tempfile.32.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +tempfile.32.o: tempfile.c i18n.h transcode.h debug.h +transcode.32.o: transcode.c globals.h string.h ../config.h http-private.h http.h +transcode.32.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +transcode.32.o: transcode.c file.h language.h i18n.h transcode.h debug.h +usersys.32.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +usersys.32.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +usersys.32.o: usersys.c i18n.h transcode.h debug.h +util.32.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h +util.32.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +util.32.o: util.c i18n.h transcode.h debug.h +testadmin.32.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +testadmin.32.o: testadmin.c file.h language.h string.h ../config.h +testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h +testarray.32.o: testarray.c debug.h +testcups.32.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +testfile.32.o: testfile.c string.h ../config.h file.h versioning.h debug.h +testhttp.32.o: testhttp.c http.h versioning.h string.h ../config.h +testi18n.32.o: testi18n.c i18n.h transcode.h language.h array.h versioning.h string.h +testi18n.32.o: testi18n.c ../config.h +testipp.32.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h +testipp.32.o: testipp.c versioning.h +testlang.32.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h +testlang.32.o: testlang.c ../config.h +testppd.32.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h versioning.h +testppd.32.o: testppd.c file.h +testsnmp.32.o: testsnmp.c string.h ../config.h snmp.h http.h versioning.h +# DO NOT DELETE + +adminutil.64.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +adminutil.64.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h +adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h +array.64.o: array.c array.h versioning.h string.h ../config.h debug.h +attr.64.o: attr.c ppd.h array.h versioning.h file.h debug.h string.h ../config.h +auth.64.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h +auth.64.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +auth.64.o: auth.c i18n.h transcode.h debug.h +backchannel.64.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h +backchannel.64.o: backchannel.c language.h +backend.64.o: backend.c backend.h versioning.h string.h ../config.h +custom.64.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h +custom.64.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +custom.64.o: custom.c i18n.h transcode.h debug.h +dest.64.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h +dest.64.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h +dest.64.o: dest.c language.h i18n.h transcode.h +dir.64.o: dir.c dir.h versioning.h string.h ../config.h debug.h +emit.64.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h +encode.64.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h +file.64.o: file.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +file.64.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +file.64.o: file.c i18n.h transcode.h debug.h +getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h +getifaddrs.64.o: getifaddrs.c ipp-private.h ipp.h +getputfile.64.o: getputfile.c globals.h string.h ../config.h http-private.h http.h +getputfile.64.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h debug.h +globals.64.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +globals.64.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +globals.64.o: globals.c i18n.h transcode.h debug.h +http.64.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +http.64.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +http.64.o: http.c i18n.h transcode.h debug.h +http-addr.64.o: http-addr.c globals.h string.h ../config.h http-private.h http.h +http-addr.64.o: http-addr.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h debug.h +http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h +http-addrlist.64.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h +http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h +http-support.64.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h +http-support.64.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +http-support.64.o: http-support.c file.h language.h i18n.h transcode.h +ipp.64.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +ipp.64.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h +ipp.64.o: ipp.c transcode.h debug.h +ipp-support.64.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h +ipp-support.64.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h +langprintf.64.o: langprintf.c globals.h string.h ../config.h http-private.h http.h +langprintf.64.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h +language.64.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h +language.64.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +language.64.o: language.c i18n.h transcode.h debug.h +localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h +localize.64.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +localize.64.o: localize.c i18n.h transcode.h debug.h +mark.64.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +mark.64.o: mark.c string.h ../config.h debug.h +md5.64.o: md5.c md5.h string.h ../config.h +md5passwd.64.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h +md5passwd.64.o: md5passwd.c ipp-private.h ipp.h string.h +notify.64.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h +notify.64.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +notify.64.o: notify.c i18n.h transcode.h +options.64.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +options.64.o: options.c string.h ../config.h debug.h +page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h +ppd.64.o: ppd.c globals.h string.h ../config.h http-private.h http.h versioning.h +ppd.64.o: ppd.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +ppd.64.o: ppd.c i18n.h transcode.h debug.h +request.64.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h +request.64.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +request.64.o: request.c i18n.h transcode.h debug.h +sidechannel.64.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h +snmp.64.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h +snmp.64.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +snmp.64.o: snmp.c i18n.h transcode.h snmp.h +snprintf.64.o: snprintf.c string.h ../config.h +string.64.o: string.c array.h versioning.h debug.h string.h ../config.h +tempfile.64.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h +tempfile.64.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +tempfile.64.o: tempfile.c i18n.h transcode.h debug.h +transcode.64.o: transcode.c globals.h string.h ../config.h http-private.h http.h +transcode.64.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h +transcode.64.o: transcode.c file.h language.h i18n.h transcode.h debug.h +usersys.64.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h +usersys.64.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h +usersys.64.o: usersys.c i18n.h transcode.h debug.h +util.64.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h +util.64.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h +util.64.o: util.c i18n.h transcode.h debug.h +testadmin.64.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h +testadmin.64.o: testadmin.c file.h language.h string.h ../config.h +testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h +testarray.64.o: testarray.c debug.h +testcups.64.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h +testfile.64.o: testfile.c string.h ../config.h file.h versioning.h debug.h +testhttp.64.o: testhttp.c http.h versioning.h string.h ../config.h +testi18n.64.o: testi18n.c i18n.h transcode.h language.h array.h versioning.h string.h +testi18n.64.o: testi18n.c ../config.h +testipp.64.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h +testipp.64.o: testipp.c versioning.h +testlang.64.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h +testlang.64.o: testlang.c ../config.h +testppd.64.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h versioning.h +testppd.64.o: testppd.c file.h +testsnmp.64.o: testsnmp.c string.h ../config.h snmp.h http.h versioning.h diff --git a/cups/Makefile b/cups/Makefile index d290c7528..e00a368e3 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -3,7 +3,7 @@ # # API library Makefile for the Common UNIX Printing System (CUPS). # -# Copyright 2007 by Apple Inc. +# Copyright 2007-2008 by Apple Inc. # Copyright 1997-2006 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the @@ -55,6 +55,7 @@ LIBOBJS = \ ppd.o \ request.o \ sidechannel.o \ + snmp.o \ snprintf.o \ string.o \ tempfile.o \ @@ -76,6 +77,7 @@ OBJS = \ testipp.o \ testlang.o \ testppd.o \ + testsnmp.o \ php_cups_wrap.o @@ -96,6 +98,7 @@ HEADERS = \ language.h \ ppd.h \ sidechannel.h \ + snmp.h \ transcode.h \ versioning.h @@ -117,7 +120,8 @@ TARGETS = \ testi18n \ testipp \ testlang \ - testppd + testppd \ + testsnmp # @@ -146,8 +150,8 @@ depend: makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1 $(RM) Dependencies cp Dependencies.tmp Dependencies - sed -r -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies - sed -r -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies + sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies + sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies $(RM) Dependencies.tmp @@ -425,6 +429,16 @@ testppd: testppd.o libcups.a # +# testsnmp (dependency on static CUPS library is intentional) +# + +testsnmp: testsnmp.o libcups.a + echo Linking $@... + $(CC) $(LDFLAGS) -o $@ testsnmp.o libcups.a \ + $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) + + +# # Automatic API help files... # diff --git a/cups/auth.c b/cups/auth.c index 6882bfad1..dd2d22c51 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -3,7 +3,7 @@ * * Authentication functions for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * This file contains Kerberos support code, copyright 2006 by diff --git a/cups/dest.c b/cups/dest.c index d7656bb28..64b2ca431 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1131,11 +1131,6 @@ appleSetDefault(const char *name) /* I - Default printer/class name */ return; } -#ifdef DEBUG - CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8); - printf("appleSetDefault: network=\"%s\"\n", name); -#endif /* DEBUG */ - if ((newprinter = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingUTF8)) == NULL) { @@ -1209,8 +1204,9 @@ appleSetDefault(const char *name) /* I - Default printer/class name */ if (newlocation) CFRelease(newlocation); } - - CFRelease(locations); + + if (locations) + CFRelease(locations); CFRelease(network); CFRelease(newprinter); } diff --git a/cups/emit.c b/cups/emit.c index ccbc02596..5ac480f35 100644 --- a/cups/emit.c +++ b/cups/emit.c @@ -3,7 +3,7 @@ * * PPD code emission routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -103,16 +103,32 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */ DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n", ppd, section, min_order, choices)); - if (ppd == NULL) + if (!ppd || !choices) + { + if (choices) + *choices = NULL; + return (0); + } /* * Allocate memory for up to N selected choices... */ - count = 0; - collect = calloc(sizeof(ppd_choice_t *), cupsArrayCount(ppd->marked)); - orders = calloc(sizeof(float), cupsArrayCount(ppd->marked)); + count = 0; + if ((collect = calloc(sizeof(ppd_choice_t *), + cupsArrayCount(ppd->marked))) == NULL) + { + *choices = NULL; + return (0); + } + + if ((orders = calloc(sizeof(float), cupsArrayCount(ppd->marked))) == NULL) + { + *choices = NULL; + free(collect); + return (0); + } /* * Loop through all options and add choices as needed... diff --git a/cups/encode.c b/cups/encode.c index 4e7f78118..9ac62b870 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -396,10 +396,44 @@ cupsEncodeOptions2( * Find the end of this value and mark it if needed... */ - if ((sep = strchr(val, ',')) != NULL) + for (sep = val; *sep; sep ++) + { + if (*sep == '\'') + { + /* + * Skip quoted option value... + */ + + sep ++; + + while (*sep && *sep != '\'') + sep ++; + + if (!*sep) + sep --; + } + else if (*sep == '\"') + { + /* + * Skip quoted option value... + */ + + sep ++; + + while (*sep && *sep != '\"') + sep ++; + + if (!*sep) + sep --; + } + else if (*sep == ',') + break; + else if (*sep == '\\' && sep[1]) + sep ++; + } + + if (*sep == ',') *sep++ = '\0'; - else - sep = val + strlen(val); /* * Copy the option value(s) over as needed by the type... diff --git a/cups/globals.h b/cups/globals.h index b310461dd..faed12951 100644 --- a/cups/globals.h +++ b/cups/globals.h @@ -3,7 +3,7 @@ * * Global variable definitions for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -97,6 +97,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ int ppd_line; /* Current line number */ ppd_conform_t ppd_conform; /* Level of conformance required */ + /* snmp.c */ + int snmp_debug; /* Log SNMP IO to stderr? */ + /* tempfile.c */ char tempfile[1024]; /* cupsTempFd/File buffer */ diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index 8f8e5c06f..6fc5a1243 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -3,7 +3,7 @@ * * HTTP address list routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -202,9 +202,11 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p * Domain socket address... */ - first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t)); - first->addr.un.sun_family = AF_LOCAL; - strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path)); + if ((first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t))) != NULL) + { + first->addr.un.sun_family = AF_LOCAL; + strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path)); + } } else #endif /* AF_LOCAL */ diff --git a/cups/http.c b/cups/http.c index 9efa1a365..f860a221d 100644 --- a/cups/http.c +++ b/cups/http.c @@ -3,7 +3,7 @@ * * HTTP routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * This file contains Kerberos support code, copyright 2006 by @@ -402,9 +402,11 @@ httpConnectEncrypt( * Allocate memory for the structure... */ - http = calloc(sizeof(http_t), 1); - if (http == NULL) + if ((http = calloc(sizeof(http_t), 1)) == NULL) + { + httpAddrFreeList(addrlist); return (NULL); + } http->version = HTTP_1_1; http->blocking = 1; @@ -1735,9 +1737,15 @@ httpSetAuthString(http_t *http, /* I - HTTP connection */ */ int len = (int)strlen(scheme) + (data ? (int)strlen(data) + 1 : 0) + 1; + char *temp; if (len > (int)sizeof(http->_authstring)) - http->authstring = malloc(len); + { + if ((temp = malloc(len)) == NULL) + len = sizeof(http->_authstring); + else + http->authstring = temp; + } if (data) snprintf(http->authstring, len, "%s %s", scheme, data); diff --git a/cups/ipp.c b/cups/ipp.c index c068d84ce..f212fd117 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -4,7 +4,7 @@ * Internet Printing Protocol support functions for the Common UNIX * Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -361,7 +361,12 @@ ippAddOctetString(ipp_t *ipp, /* I - IPP message */ if (data) { - attr->values[0].unknown.data = malloc(datalen); + if ((attr->values[0].unknown.data = malloc(datalen)) == NULL) + { + ippDeleteAttribute(ipp, attr); + return (NULL); + } + memcpy(attr->values[0].unknown.data, data, datalen); } @@ -1277,7 +1282,11 @@ ippReadIO(void *src, /* I - Data source */ if (ipp->current) ipp->prev = ipp->current; - attr = ipp->current = _ippAddAttr(ipp, 1); + if ((attr = ipp->current = _ippAddAttr(ipp, 1)) == NULL) + { + DEBUG_puts("ippReadIO: unable to allocate attribute!"); + return (IPP_ERROR); + } DEBUG_printf(("ippReadIO: name=\'%s\', ipp->current=%p, ipp->prev=%p\n", buffer, ipp->current, ipp->prev)); @@ -1538,7 +1547,7 @@ ippReadIO(void *src, /* I - Data source */ break; default : /* Other unsupported values */ - if (n > sizeof(buffer)) + if (n > IPP_MAX_LENGTH) { DEBUG_printf(("ippReadIO: bad value length %d!\n", n)); return (IPP_ERROR); @@ -1547,7 +1556,12 @@ ippReadIO(void *src, /* I - Data source */ value->unknown.length = n; if (n > 0) { - value->unknown.data = malloc(n); + if ((value->unknown.data = malloc(n)) == NULL) + { + DEBUG_puts("ippReadIO: Unable to allocate value"); + return (IPP_ERROR); + } + if ((*cb)(src, value->unknown.data, n) < n) { DEBUG_puts("ippReadIO: Unable to read unsupported value!"); diff --git a/cups/language.c b/cups/language.c index a94a3ae4b..ea629c903 100644 --- a/cups/language.c +++ b/cups/language.c @@ -3,7 +3,7 @@ * * I18N/language support for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -975,7 +975,12 @@ _cupsMessageLoad(const char *filename) /* I - Message catalog to load */ return (a); } - m->id = strdup(ptr); + if ((m->id = strdup(ptr)) == NULL) + { + free(m); + cupsFileClose(fp); + return (a); + } } else if (s[0] == '\"' && m) { @@ -1023,7 +1028,11 @@ _cupsMessageLoad(const char *filename) /* I - Message catalog to load */ * Set the string... */ - m->str = strdup(ptr); + if ((m->str = strdup(ptr)) == NULL) + { + cupsFileClose(fp); + return (a); + } } } diff --git a/cups/libcups.exp b/cups/libcups.exp index de8fd50c9..a757eedcd 100644 --- a/cups/libcups.exp +++ b/cups/libcups.exp @@ -146,6 +146,14 @@ _cupsPutFile _cupsReadResponseData _cupsRemoveDest _cupsRemoveOption +_cupsSNMPClose +_cupsSNMPCopyOID +_cupsSNMPIsOID +_cupsSNMPIsOIDPrefixed +_cupsSNMPOpen +_cupsSNMPRead +_cupsSNMPSetDebug +_cupsSNMPWrite _cupsSendRequest _cupsServer _cupsSetDefaultDest diff --git a/cups/options.c b/cups/options.c index b0d703e63..f04138497 100644 --- a/cups/options.c +++ b/cups/options.c @@ -3,7 +3,7 @@ * * Option routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -473,15 +473,24 @@ cupsParseOptions( *value; /* Pointer to value */ - if (arg == NULL || options == NULL || num_options < 0) + /* + * Range check input... + */ + + if (!arg) + return (num_options); + + if (!options || num_options < 0) return (0); /* * Make a copy of the argument string and then divide it up... */ - copyarg = strdup(arg); - ptr = copyarg; + if ((copyarg = strdup(arg)) == NULL) + return (num_options); + + ptr = copyarg; /* * Skip leading spaces... diff --git a/cups/ppd.c b/cups/ppd.c index 50ad5787f..ea9eb86b7 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -3,7 +3,7 @@ * * PPD file routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -826,6 +826,13 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ profile = realloc(ppd->profiles, sizeof(ppd_profile_t) * (ppd->num_profiles + 1)); + if (!profile) + { + cg->ppd_status = PPD_ALLOC_ERROR; + + goto error; + } + ppd->profiles = profile; profile += ppd->num_profiles; ppd->num_profiles ++; @@ -1112,7 +1119,12 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ } ppd->num_emulations = count; - ppd->emulations = calloc(count, sizeof(ppd_emul_t)); + if ((ppd->emulations = calloc(count, sizeof(ppd_emul_t))) == NULL) + { + cg->ppd_status = PPD_ALLOC_ERROR; + + goto error; + } for (i = 0, sptr = string; i < count; i ++) { @@ -1875,7 +1887,12 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ * Add the option choice... */ - choice = ppd_add_choice(option, name); + if ((choice = ppd_add_choice(option, name)) == NULL) + { + cg->ppd_status = PPD_ALLOC_ERROR; + + goto error; + } if (text[0]) cupsCharsetToUTF8((cups_utf8_t *)choice->text, text, diff --git a/cups/snmp.c b/cups/snmp.c new file mode 100644 index 000000000..123f96538 --- /dev/null +++ b/cups/snmp.c @@ -0,0 +1,1268 @@ +/* + * "$Id$" + * + * SNMP functions for the Common UNIX Printing System (CUPS). + * + * Copyright 2007-2008 by Apple Inc. + * Copyright 2006-2007 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * "LICENSE" which should have been included with this file. If this + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * cupsSNMPClose() - Close a SNMP socket. + * cupsSNMPCopyOID() - Copy an OID. + * cupsSNMPIsOID() - Test whether a SNMP response contains the + * specified OID. + * cupsSNMPIsOIDPrefixed() - Test whether a SNMP response uses the specified + * OID prefix. + * cupsSNMPOpen() - Open a SNMP socket. + * cupsSNMPRead() - Read and parse a SNMP response... + * cupsSNMPSetDebug() - Enable/disable debug logging to stderr. + * cupsSNMPWrite() - Send an SNMP query packet. + * asn1_decode_snmp() - Decode a SNMP packet. + * asn1_debug() - Decode an ASN1-encoded message. + * asn1_encode_snmp() - Encode a SNMP packet. + * asn1_get_integer() - Get an integer value. + * asn1_get_length() - Get a value length. + * asn1_get_oid() - Get an OID value. + * asn1_get_packed() - Get a packed integer value. + * asn1_get_string() - Get a string value. + * asn1_get_type() - Get a value type. + * asn1_set_integer() - Set an integer value. + * asn1_set_length() - Set a value length. + * asn1_set_oid() - Set an OID value. + * asn1_set_packed() - Set a packed integer value. + * asn1_size_integer() - Figure out the number of bytes needed for an + * integer value. + * asn1_size_length() - Figure out the number of bytes needed for a + * length value. + * asn1_size_oid() - Figure out the numebr of bytes needed for an OID + * value. + * asn1_size_packed() - Figure out the number of bytes needed for a + * packed integer value. + * snmp_set_error() - Set the localized error for a packet. + */ + +/* + * Include necessary headers. + */ + +#include "globals.h" +#include "snmp.h" +#include <errno.h> +#ifdef HAVE_POLL +# include <sys/poll.h> +#endif /* HAVE_POLL */ + + +/* + * Local functions... + */ + +static int asn1_decode_snmp(unsigned char *buffer, size_t len, + cups_snmp_t *packet); +static void asn1_debug(const char *prefix, unsigned char *buffer, + size_t len, int indent); +static int asn1_encode_snmp(unsigned char *buffer, size_t len, + cups_snmp_t *packet); +static int asn1_get_integer(unsigned char **buffer, + unsigned char *bufend, + int length); +static int asn1_get_oid(unsigned char **buffer, + unsigned char *bufend, + int length, int *oid, int oidsize); +static int asn1_get_packed(unsigned char **buffer, + unsigned char *bufend); +static char *asn1_get_string(unsigned char **buffer, + unsigned char *bufend, + int length, char *string, + int strsize); +static int asn1_get_length(unsigned char **buffer, + unsigned char *bufend); +static int asn1_get_type(unsigned char **buffer, + unsigned char *bufend); +static void asn1_set_integer(unsigned char **buffer, + int integer); +static void asn1_set_length(unsigned char **buffer, + int length); +static void asn1_set_oid(unsigned char **buffer, + const int *oid); +static void asn1_set_packed(unsigned char **buffer, + int integer); +static int asn1_size_integer(int integer); +static int asn1_size_length(int length); +static int asn1_size_oid(const int *oid); +static int asn1_size_packed(int integer); +static void snmp_set_error(cups_snmp_t *packet, + const char *message); + + +/* + * 'cupsSNMPClose()' - Close a SNMP socket. + * + * @since CUPS 1.4@ + */ + +void +cupsSNMPClose(int fd) /* I - SNMP socket file descriptor */ +{ +#ifdef WIN32 + closesocket(fd); +#else + close(fd); +#endif /* WIN32 */ +} + + +/* + * 'cupsSNMPCopyOID()' - Copy an OID. + */ + +int * /* O - New OID */ +cupsSNMPCopyOID(int *dst, /* I - Destination OID */ + const int *src, /* I - Source OID */ + int dstsize) /* I - Number of integers in dst */ +{ + int i; /* Looping var */ + + + for (i = 0, dstsize --; src[i] && i < dstsize; i ++) + dst[i] = src[i]; + + dst[i] = 0; + + return (dst); +} + + +/* + * 'cupsSNMPIsOID()' - Test whether a SNMP response contains the specified OID. + * + * The array pointed to by "oid" is 0-terminated. + * + * @since CUPS 1.4@ + */ + +int /* O - 1 if equal, 0 if not equal */ +cupsSNMPIsOID(cups_snmp_t *packet, /* I - Response packet */ + const int *oid) /* I - OID */ +{ + int i; /* Looping var */ + + + /* + * Range check input... + */ + + if (!packet || !oid) + return (0); + + /* + * Compare OIDs... + */ + + for (i = 0; i < CUPS_SNMP_MAX_OID && oid[i] && packet->object_name[i]; i ++) + if (oid[i] != packet->object_name[i]) + return (0); + + return (i < CUPS_SNMP_MAX_OID && oid[i] == packet->object_name[i]); +} + + +/* + * 'cupsSNMPIsOIDPrefixed()' - Test whether a SNMP response uses the specified + * OID prefix. + * + * The array pointed to by "prefix" is 0-terminated. + * + * @since CUPS 1.4@ + */ + +int /* O - 1 if prefixed, 0 if not prefixed */ +cupsSNMPIsOIDPrefixed( + cups_snmp_t *packet, /* I - Response packet */ + const int *prefix) /* I - OID prefix */ +{ + int i; /* Looping var */ + + + /* + * Range check input... + */ + + if (!packet || !prefix) + return (0); + + /* + * Compare OIDs... + */ + + for (i = 0; + i < CUPS_SNMP_MAX_OID && prefix[i] && packet->object_name[i]; + i ++) + if (prefix[i] != packet->object_name[i]) + return (0); + + return (i < CUPS_SNMP_MAX_OID); +} + + +/* + * 'cupsSNMPOpen()' - Open a SNMP socket. + * + * @since CUPS 1.4@ + */ + +int /* O - SNMP socket file descriptor */ +cupsSNMPOpen(void) +{ + int fd; /* SNMP socket file descriptor */ + int val; /* Socket option value */ + + + /* + * Create the SNMP socket... + */ + + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + return (-1); + + /* + * Set the "broadcast" flag... + */ + + val = 1; + + if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val))) + { + close(fd); + + return (-1); + } + + return (fd); +} + + +/* + * 'cupsSNMPRead()' - Read and parse a SNMP response... + * + * If "timeout" is negative, cupsSNMPRead() will wait for a response + * indefinitely. + * + * @since CUPS 1.4@ + */ + +cups_snmp_t * /* O - SNMP packet or NULL if none */ +cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */ + cups_snmp_t *packet, /* I - SNMP packet buffer */ + int msec) /* I - Timeout in milliseconds */ +{ + unsigned char buffer[CUPS_SNMP_MAX_PACKET]; + /* Data packet */ + int bytes; /* Number of bytes received */ + socklen_t addrlen; /* Source address length */ + + + /* + * Range check input... + */ + + if (fd < 0 || !packet) + return (NULL); + + /* + * Optionally wait for a response... + */ + + if (msec >= 0) + { + int ready; /* Data ready on socket? */ +#ifdef HAVE_POLL + struct pollfd pfd; /* Polled file descriptor */ + + pfd.fd = fd; + pfd.events = POLLIN; + + while ((ready = poll(&pfd, 1, msec)) < 0 && errno == EINTR); + +#else + fd_set input_set; /* select() input set */ + struct timeval timeout; /* select() timeout */ + + do + { + FD_ZERO(&input_set); + FD_SET(fd, &input_set); + + timeout.tv_sec = msec / 1000; + timeout.tv_usec = (msec % 1000) * 1000; + + ready = select(fd + 1, &input_set, NULL, NULL, &timeout); + } +# ifdef WIN32 + while (ready < 0 && WSAGetLastError() == WSAEINTR); +# else + while (ready < 0 && errno == EINTR); +# endif /* WIN32 */ +#endif /* HAVE_POLL */ + + /* + * If we don't have any data ready, return right away... + */ + + if (ready <= 0) + return (NULL); + } + + /* + * Read the response data... + */ + + addrlen = sizeof(packet->address); + + if ((bytes = recvfrom(fd, buffer, sizeof(buffer), 0, + (void *)&(packet->address), &addrlen)) < 0) + return (NULL); + + /* + * Look for the response status code in the SNMP message header... + */ + + asn1_debug("DEBUG: IN ", buffer, bytes, 0); + + asn1_decode_snmp(buffer, bytes, packet); + + /* + * Return decoded data packet... + */ + + return (packet); +} + + +/* + * 'cupsSNMPSetDebug()' - Enable/disable debug logging to stderr. + * + * @since CUPS 1.4@ + */ + +void +cupsSNMPSetDebug(int level) /* I - 1 to enable debug output, 0 otherwise */ +{ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + cg->snmp_debug = level; +} + + +/* + * 'cupsSNMPWrite()' - Send an SNMP query packet. + * + * The array pointed to by "oid" is 0-terminated. + * + * @since CUPS 1.4@ + */ + +int /* O - 1 on success, 0 on error */ +cupsSNMPWrite( + int fd, /* I - SNMP socket */ + http_addr_t *address, /* I - Address to send to */ + int version, /* I - SNMP version */ + const char *community, /* I - Community name */ + cups_asn1_t request_type, /* I - Request type */ + const unsigned request_id, /* I - Request ID */ + const int *oid) /* I - OID */ +{ + int i; /* Looping var */ + cups_snmp_t packet; /* SNMP message packet */ + unsigned char buffer[CUPS_SNMP_MAX_PACKET]; + /* SNMP message buffer */ + int bytes; /* Size of message */ + + + /* + * Create the SNMP message... + */ + + memset(&packet, 0, sizeof(packet)); + + packet.version = version; + packet.request_type = request_type; + packet.request_id = request_id; + packet.object_type = CUPS_ASN1_NULL_VALUE; + + strlcpy(packet.community, community, sizeof(packet.community)); + + for (i = 0; oid[i]; i ++) + packet.object_name[i] = oid[i]; + + bytes = asn1_encode_snmp(buffer, sizeof(buffer), &packet); + + if (bytes < 0) + { + errno = E2BIG; + + return (0); + } + + asn1_debug("DEBUG: OUT ", buffer, bytes, 0); + + /* + * Send the message... + */ + +#ifdef AF_INET6 + if (address->addr.sa_family == AF_INET6) + address->ipv6.sin6_port = htons(CUPS_SNMP_PORT); + else +#endif /* AF_INET6 */ + address->ipv4.sin_port = htons(CUPS_SNMP_PORT); + + return (sendto(fd, buffer, bytes, 0, (void *)address, + httpAddrLength(address)) == bytes); +} + + +/* + * 'asn1_decode_snmp()' - Decode a SNMP packet. + */ + +static int /* O - 0 on success, -1 on error */ +asn1_decode_snmp(unsigned char *buffer, /* I - Buffer */ + size_t len, /* I - Size of buffer */ + cups_snmp_t *packet) /* I - SNMP packet */ +{ + unsigned char *bufptr, /* Pointer into the data */ + *bufend; /* End of data */ + int length; /* Length of value */ + + + /* + * Initialize the decoding... + */ + + memset(packet, 0, sizeof(cups_snmp_t)); + + bufptr = buffer; + bufend = buffer + len; + + if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_SEQUENCE) + snmp_set_error(packet, _("Packet does not start with SEQUENCE")); + else if (asn1_get_length(&bufptr, bufend) == 0) + snmp_set_error(packet, _("SEQUENCE uses indefinite length")); + else if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_INTEGER) + snmp_set_error(packet, _("No version number")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("Version uses indefinite length")); + else if ((packet->version = asn1_get_integer(&bufptr, bufend, length)) + != CUPS_SNMP_VERSION_1) + snmp_set_error(packet, _("Bad SNMP version number")); + else if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_OCTET_STRING) + snmp_set_error(packet, _("No community name")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("Community name uses indefinite length")); + else + { + asn1_get_string(&bufptr, bufend, length, packet->community, + sizeof(packet->community)); + + if ((packet->request_type = asn1_get_type(&bufptr, bufend)) + != CUPS_ASN1_GET_RESPONSE) + snmp_set_error(packet, _("Packet does not contain a Get-Response-PDU")); + else if (asn1_get_length(&bufptr, bufend) == 0) + snmp_set_error(packet, _("Get-Response-PDU uses indefinite length")); + else if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_INTEGER) + snmp_set_error(packet, _("No request-id")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("request-id uses indefinite length")); + else + { + packet->request_id = asn1_get_integer(&bufptr, bufend, length); + + if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_INTEGER) + snmp_set_error(packet, _("No error-status")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("error-status uses indefinite length")); + else + { + packet->error_status = asn1_get_integer(&bufptr, bufend, length); + + if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_INTEGER) + snmp_set_error(packet, _("No error-index")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("error-index uses indefinite length")); + else + { + packet->error_index = asn1_get_integer(&bufptr, bufend, length); + + if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_SEQUENCE) + snmp_set_error(packet, _("No variable-bindings SEQUENCE")); + else if (asn1_get_length(&bufptr, bufend) == 0) + snmp_set_error(packet, + _("variable-bindings uses indefinite length")); + else if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_SEQUENCE) + snmp_set_error(packet, _("No VarBind SEQUENCE")); + else if (asn1_get_length(&bufptr, bufend) == 0) + snmp_set_error(packet, _("VarBind uses indefinite length")); + else if (asn1_get_type(&bufptr, bufend) != CUPS_ASN1_OID) + snmp_set_error(packet, _("No name OID")); + else if ((length = asn1_get_length(&bufptr, bufend)) == 0) + snmp_set_error(packet, _("Name OID uses indefinite length")); + else + { + asn1_get_oid(&bufptr, bufend, length, packet->object_name, + CUPS_SNMP_MAX_OID); + + packet->object_type = asn1_get_type(&bufptr, bufend); + + if ((length = asn1_get_length(&bufptr, bufend)) == 0 && + packet->object_type != CUPS_ASN1_NULL_VALUE && + packet->object_type != CUPS_ASN1_OCTET_STRING) + snmp_set_error(packet, _("Value uses indefinite length")); + else + { + switch (packet->object_type) + { + case CUPS_ASN1_BOOLEAN : + packet->object_value.boolean = + asn1_get_integer(&bufptr, bufend, length); + break; + + case CUPS_ASN1_INTEGER : + packet->object_value.integer = + asn1_get_integer(&bufptr, bufend, length); + break; + + case CUPS_ASN1_NULL_VALUE : + break; + + case CUPS_ASN1_OCTET_STRING : + asn1_get_string(&bufptr, bufend, length, + packet->object_value.string, + CUPS_SNMP_MAX_STRING); + break; + + case CUPS_ASN1_OID : + asn1_get_oid(&bufptr, bufend, length, + packet->object_value.oid, CUPS_SNMP_MAX_OID); + break; + + case CUPS_ASN1_COUNTER : + packet->object_value.counter = + asn1_get_integer(&bufptr, bufend, length); + break; + + case CUPS_ASN1_GAUGE : + packet->object_value.gauge = + asn1_get_integer(&bufptr, bufend, length); + break; + + default : + snmp_set_error(packet, _("Unsupported value type")); + break; + } + } + } + } + } + } + } + + return (packet->error ? -1 : 0); +} + + +/* + * 'asn1_debug()' - Decode an ASN1-encoded message. + */ + +static void +asn1_debug(const char *prefix, /* I - Prefix string */ + unsigned char *buffer, /* I - Buffer */ + size_t len, /* I - Length of buffer */ + int indent) /* I - Indentation */ +{ + int i; /* Looping var */ + unsigned char *bufend; /* End of buffer */ + int integer; /* Number value */ + int oid[CUPS_SNMP_MAX_OID]; /* OID value */ + char string[CUPS_SNMP_MAX_STRING]; + /* String value */ + unsigned char value_type; /* Type of value */ + int value_length; /* Length of value */ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + if (cg->snmp_debug <= 0) + return; + + bufend = buffer + len; + + while (buffer < bufend) + { + /* + * Get value type... + */ + + value_type = asn1_get_type(&buffer, bufend); + value_length = asn1_get_length(&buffer, bufend); + + switch (value_type) + { + case CUPS_ASN1_BOOLEAN : + integer = asn1_get_integer(&buffer, bufend, value_length); + + fprintf(stderr, "%s%*sBOOLEAN %d bytes %d\n", prefix, indent, "", + value_length, integer); + break; + + case CUPS_ASN1_INTEGER : + integer = asn1_get_integer(&buffer, bufend, value_length); + + fprintf(stderr, "%s%*sINTEGER %d bytes %d\n", prefix, indent, "", + value_length, integer); + break; + + case CUPS_ASN1_OCTET_STRING : + fprintf(stderr, "%s%*sOCTET STRING %d bytes \"%s\"\n", prefix, + indent, "", value_length, + asn1_get_string(&buffer, bufend, value_length, string, + sizeof(string))); + break; + + case CUPS_ASN1_NULL_VALUE : + fprintf(stderr, "%s%*sNULL VALUE %d bytes\n", prefix, indent, "", + value_length); + + buffer += value_length; + break; + + case CUPS_ASN1_OID : + asn1_get_oid(&buffer, bufend, value_length, oid, CUPS_SNMP_MAX_OID); + + fprintf(stderr, "%s%*sOID %d bytes ", prefix, indent, "", + value_length); + for (i = 0; oid[i]; i ++) + fprintf(stderr, ".%d", oid[i]); + putc('\n', stderr); + break; + + case CUPS_ASN1_SEQUENCE : + fprintf(stderr, "%s%*sSEQUENCE %d bytes\n", prefix, indent, "", + value_length); + asn1_debug(prefix, buffer, value_length, indent + 4); + + buffer += value_length; + break; + + case CUPS_ASN1_GET_REQUEST : + fprintf(stderr, "%s%*sGet-Request-PDU %d bytes\n", prefix, indent, "", + value_length); + asn1_debug(prefix, buffer, value_length, indent + 4); + + buffer += value_length; + break; + + case CUPS_ASN1_GET_RESPONSE : + fprintf(stderr, "%s%*sGet-Response-PDU %d bytes\n", prefix, indent, + "", value_length); + asn1_debug(prefix, buffer, value_length, indent + 4); + + buffer += value_length; + break; + + default : + fprintf(stderr, "%s%*sUNKNOWN(%x) %d bytes\n", prefix, indent, "", + value_type, value_length); + + buffer += value_length; + break; + } + } +} + + +/* + * 'asn1_encode_snmp()' - Encode a SNMP packet. + */ + +static int /* O - Length on success, -1 on error */ +asn1_encode_snmp(unsigned char *buffer, /* I - Buffer */ + size_t bufsize, /* I - Size of buffer */ + cups_snmp_t *packet) /* I - SNMP packet */ +{ + unsigned char *bufptr; /* Pointer into buffer */ + int total, /* Total length */ + msglen, /* Length of entire message */ + commlen, /* Length of community string */ + reqlen, /* Length of request */ + listlen, /* Length of variable list */ + varlen, /* Length of variable */ + namelen, /* Length of object name OID */ + valuelen; /* Length of object value */ + + + /* + * Get the lengths of the community string, OID, and message... + */ + + namelen = asn1_size_oid(packet->object_name); + + switch (packet->object_type) + { + case CUPS_ASN1_NULL_VALUE : + valuelen = 0; + break; + + case CUPS_ASN1_BOOLEAN : + valuelen = asn1_size_integer(packet->object_value.boolean); + break; + + case CUPS_ASN1_INTEGER : + valuelen = asn1_size_integer(packet->object_value.integer); + break; + + case CUPS_ASN1_OCTET_STRING : + valuelen = strlen(packet->object_value.string); + break; + + case CUPS_ASN1_OID : + valuelen = asn1_size_oid(packet->object_value.oid); + break; + + default : + packet->error = "Unknown object type"; + return (-1); + } + + varlen = 1 + asn1_size_length(namelen) + namelen + + 1 + asn1_size_length(valuelen) + valuelen; + listlen = 1 + asn1_size_length(varlen) + varlen; + reqlen = 2 + asn1_size_integer(packet->request_id) + + 2 + asn1_size_integer(packet->error_status) + + 2 + asn1_size_integer(packet->error_index) + + 1 + asn1_size_length(listlen) + listlen; + commlen = strlen(packet->community); + msglen = 2 + asn1_size_integer(packet->version) + + 1 + asn1_size_length(commlen) + commlen + + 1 + asn1_size_length(reqlen) + reqlen; + total = 1 + asn1_size_length(msglen) + msglen; + + if (total > bufsize) + { + packet->error = "Message too large for buffer"; + return (-1); + } + + /* + * Then format the message... + */ + + bufptr = buffer; + + *bufptr++ = CUPS_ASN1_SEQUENCE; /* SNMPv1 message header */ + asn1_set_length(&bufptr, msglen); + + asn1_set_integer(&bufptr, packet->version); + /* version */ + + *bufptr++ = CUPS_ASN1_OCTET_STRING; /* community */ + asn1_set_length(&bufptr, commlen); + memcpy(bufptr, packet->community, commlen); + bufptr += commlen; + + *bufptr++ = packet->request_type; /* Get-Request-PDU */ + asn1_set_length(&bufptr, reqlen); + + asn1_set_integer(&bufptr, packet->request_id); + + asn1_set_integer(&bufptr, packet->error_status); + + asn1_set_integer(&bufptr, packet->error_index); + + *bufptr++ = CUPS_ASN1_SEQUENCE; /* variable-bindings */ + asn1_set_length(&bufptr, listlen); + + *bufptr++ = CUPS_ASN1_SEQUENCE; /* variable */ + asn1_set_length(&bufptr, varlen); + + asn1_set_oid(&bufptr, packet->object_name); + /* ObjectName */ + + switch (packet->object_type) + { + case CUPS_ASN1_NULL_VALUE : + *bufptr++ = CUPS_ASN1_NULL_VALUE; + /* ObjectValue */ + *bufptr++ = 0; /* Length */ + break; + + case CUPS_ASN1_BOOLEAN : + asn1_set_integer(&bufptr, packet->object_value.boolean); + break; + + case CUPS_ASN1_INTEGER : + asn1_set_integer(&bufptr, packet->object_value.integer); + break; + + case CUPS_ASN1_OCTET_STRING : + *bufptr++ = CUPS_ASN1_OCTET_STRING; + asn1_set_length(&bufptr, valuelen); + memcpy(bufptr, packet->object_value.string, valuelen); + bufptr += valuelen; + break; + + case CUPS_ASN1_OID : + asn1_set_oid(&bufptr, packet->object_value.oid); + break; + + default : + break; + } + + return (bufptr - buffer); +} + + +/* + * 'asn1_get_integer()' - Get an integer value. + */ + +static int /* O - Integer value */ +asn1_get_integer( + unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend, /* I - End of buffer */ + int length) /* I - Length of value */ +{ + int value; /* Integer value */ + + + for (value = 0; + length > 0 && *buffer < bufend; + length --, (*buffer) ++) + value = (value << 8) | **buffer; + + return (value); +} + + +/* + * 'asn1_get_length()' - Get a value length. + */ + +static int /* O - Length */ +asn1_get_length(unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend) /* I - End of buffer */ +{ + int length; /* Length */ + + + length = **buffer; + (*buffer) ++; + + if (length & 128) + length = asn1_get_integer(buffer, bufend, length & 127); + + return (length); +} + + +/* + * 'asn1_get_oid()' - Get an OID value. + */ + +static int /* O - Last OID number */ +asn1_get_oid( + unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend, /* I - End of buffer */ + int length, /* I - Length of value */ + int *oid, /* I - OID buffer */ + int oidsize) /* I - Size of OID buffer */ +{ + unsigned char *valend; /* End of value */ + int *oidend; /* End of OID buffer */ + int number; /* OID number */ + + + valend = *buffer + length; + oidend = oid + oidsize - 1; + + if (valend > bufend) + valend = bufend; + + number = asn1_get_packed(buffer, bufend); + + if (number < 80) + { + *oid++ = number / 40; + number = number % 40; + *oid++ = number; + } + else + { + *oid++ = 2; + number -= 80; + *oid++ = number; + } + + while (*buffer < valend) + { + number = asn1_get_packed(buffer, bufend); + + if (oid < oidend) + *oid++ = number; + } + + *oid = 0; + + return (number); +} + + +/* + * 'asn1_get_packed()' - Get a packed integer value. + */ + +static int /* O - Value */ +asn1_get_packed( + unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend) /* I - End of buffer */ +{ + int value; /* Value */ + + + value = 0; + + while ((**buffer & 128) && *buffer < bufend) + { + value = (value << 7) | (**buffer & 127); + (*buffer) ++; + } + + if (*buffer < bufend) + { + value = (value << 7) | **buffer; + (*buffer) ++; + } + + return (value); +} + + +/* + * 'asn1_get_string()' - Get a string value. + */ + +static char * /* O - String */ +asn1_get_string( + unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend, /* I - End of buffer */ + int length, /* I - Value length */ + char *string, /* I - String buffer */ + int strsize) /* I - String buffer size */ +{ + if (length < 0) + { + /* + * Disallow negative lengths! + */ + + *string = '\0'; + } + else if (length < strsize) + { + /* + * String is smaller than the buffer... + */ + + if (length > 0) + memcpy(string, *buffer, length); + + string[length] = '\0'; + } + else + { + /* + * String is larger than the buffer... + */ + + memcpy(string, *buffer, strsize - 1); + string[strsize - 1] = '\0'; + } + + if (length > 0) + (*buffer) += length; + + return (length < 0 ? NULL : string); +} + + +/* + * 'asn1_get_type()' - Get a value type. + */ + +static int /* O - Type */ +asn1_get_type(unsigned char **buffer, /* IO - Pointer in buffer */ + unsigned char *bufend) /* I - End of buffer */ +{ + int type; /* Type */ + + + type = **buffer; + (*buffer) ++; + + if ((type & 31) == 31) + type = asn1_get_packed(buffer, bufend); + + return (type); +} + + +/* + * 'asn1_set_integer()' - Set an integer value. + */ + +static void +asn1_set_integer(unsigned char **buffer,/* IO - Pointer in buffer */ + int integer) /* I - Integer value */ +{ + **buffer = CUPS_ASN1_INTEGER; + (*buffer) ++; + + if (integer > 0x7fffff || integer < -0x800000) + { + **buffer = 4; + (*buffer) ++; + **buffer = integer >> 24; + (*buffer) ++; + **buffer = integer >> 16; + (*buffer) ++; + **buffer = integer >> 8; + (*buffer) ++; + **buffer = integer; + (*buffer) ++; + } + else if (integer > 0x7fff || integer < -0x8000) + { + **buffer = 3; + (*buffer) ++; + **buffer = integer >> 16; + (*buffer) ++; + **buffer = integer >> 8; + (*buffer) ++; + **buffer = integer; + (*buffer) ++; + } + else if (integer > 0x7f || integer < -0x80) + { + **buffer = 2; + (*buffer) ++; + **buffer = integer >> 8; + (*buffer) ++; + **buffer = integer; + (*buffer) ++; + } + else + { + **buffer = 1; + (*buffer) ++; + **buffer = integer; + (*buffer) ++; + } +} + + +/* + * 'asn1_set_length()' - Set a value length. + */ + +static void +asn1_set_length(unsigned char **buffer, /* IO - Pointer in buffer */ + int length) /* I - Length value */ +{ + if (length > 255) + { + **buffer = 0x82; /* 2-byte length */ + (*buffer) ++; + **buffer = length >> 8; + (*buffer) ++; + **buffer = length; + (*buffer) ++; + } + else if (length > 127) + { + **buffer = 0x81; /* 1-byte length */ + (*buffer) ++; + **buffer = length; + (*buffer) ++; + } + else + { + **buffer = length; /* Length */ + (*buffer) ++; + } +} + + +/* + * 'asn1_set_oid()' - Set an OID value. + */ + +static void +asn1_set_oid(unsigned char **buffer, /* IO - Pointer in buffer */ + const int *oid) /* I - OID value */ +{ + **buffer = CUPS_ASN1_OID; + (*buffer) ++; + + asn1_set_length(buffer, asn1_size_oid(oid)); + + asn1_set_packed(buffer, oid[0] * 40 + oid[1]); + + for (oid += 2; *oid; oid ++) + asn1_set_packed(buffer, *oid); +} + + +/* + * 'asn1_set_packed()' - Set a packed integer value. + */ + +static void +asn1_set_packed(unsigned char **buffer, /* IO - Pointer in buffer */ + int integer) /* I - Integer value */ +{ + if (integer > 0xfffffff) + { + **buffer = (integer >> 28) & 0x7f; + (*buffer) ++; + } + + if (integer > 0x1fffff) + { + **buffer = (integer >> 21) & 0x7f; + (*buffer) ++; + } + + if (integer > 0x3fff) + { + **buffer = (integer >> 14) & 0x7f; + (*buffer) ++; + } + + if (integer > 0x7f) + { + **buffer = (integer >> 7) & 0x7f; + (*buffer) ++; + } + + **buffer = integer & 0x7f; + (*buffer) ++; +} + + +/* + * 'asn1_size_integer()' - Figure out the number of bytes needed for an + * integer value. + */ + +static int /* O - Size in bytes */ +asn1_size_integer(int integer) /* I - Integer value */ +{ + if (integer > 0x7fffff || integer < -0x800000) + return (4); + else if (integer > 0x7fff || integer < -0x8000) + return (3); + else if (integer > 0x7f || integer < -0x80) + return (2); + else + return (1); +} + + +/* + * 'asn1_size_length()' - Figure out the number of bytes needed for a + * length value. + */ + +static int /* O - Size in bytes */ +asn1_size_length(int length) /* I - Length value */ +{ + if (length > 0xff) + return (3); + else if (length > 0x7f) + return (2); + else + return (1); +} + + +/* + * 'asn1_size_oid()' - Figure out the numebr of bytes needed for an + * OID value. + */ + +static int /* O - Size in bytes */ +asn1_size_oid(const int *oid) /* I - OID value */ +{ + int length; /* Length of value */ + + + for (length = asn1_size_packed(oid[0] * 40 + oid[1]), oid += 2; *oid; oid ++) + length += asn1_size_packed(*oid); + + return (length); +} + + +/* + * 'asn1_size_packed()' - Figure out the number of bytes needed for a + * packed integer value. + */ + +static int /* O - Size in bytes */ +asn1_size_packed(int integer) /* I - Integer value */ +{ + if (integer > 0xfffffff) + return (5); + else if (integer > 0x1fffff) + return (4); + else if (integer > 0x3fff) + return (3); + else if (integer > 0x7f) + return (2); + else + return (1); +} + + +/* + * 'snmp_set_error()' - Set the localized error for a packet. + */ + +static void +snmp_set_error(cups_snmp_t *packet, /* I - Packet */ + const char *message) /* I - Error message */ +{ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); + + packet->error = _cupsLangString(cg->lang_default, message); +} + + +/* + * End of "$Id$". + */ diff --git a/cups/snmp.h b/cups/snmp.h new file mode 100644 index 000000000..b0a9703be --- /dev/null +++ b/cups/snmp.h @@ -0,0 +1,121 @@ +/* + * "$Id$" + * + * SNMP definitions for the Common UNIX Printing System (CUPS). + * + * Copyright 2007-2008 by Apple Inc. + * Copyright 2006-2007 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * "LICENSE" which should have been included with this file. If this + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_SNMP_H_ +# define _CUPS_SNMP_H_ + + +/* + * Include necessary headers. + */ + +#include "http.h" + + +/* + * Constants... + */ + +#define CUPS_SNMP_PORT 161 /* SNMP well-known port */ +#define CUPS_SNMP_MAX_OID 128 /* Maximum number of OID numbers */ +#define CUPS_SNMP_MAX_PACKET 1472 /* Maximum size of SNMP packet */ +#define CUPS_SNMP_MAX_STRING 512 /* Maximum size of string */ +#define CUPS_SNMP_VERSION_1 0 /* SNMPv1 */ + + +/* + * Types... + */ + +typedef enum cups_asn1_e /**** ASN1 request/object types ****/ +{ + CUPS_ASN1_END_OF_CONTENTS = 0x00, /* End-of-contents */ + CUPS_ASN1_BOOLEAN = 0x01, /* BOOLEAN */ + CUPS_ASN1_INTEGER = 0x02, /* INTEGER or ENUMERATION */ + CUPS_ASN1_BIT_STRING = 0x03, /* BIT STRING */ + CUPS_ASN1_OCTET_STRING = 0x04, /* OCTET STRING */ + CUPS_ASN1_NULL_VALUE = 0x05, /* NULL VALUE */ + CUPS_ASN1_OID = 0x06, /* OBJECT IDENTIFIER */ + CUPS_ASN1_SEQUENCE = 0x30, /* SEQUENCE */ + CUPS_ASN1_APPLICATION = 0x40, /* Application-specific bit */ + CUPS_ASN1_COUNTER = 0x41, /* 32-bit unsigned aka Counter32 */ + CUPS_ASN1_GAUGE = 0x42, /* 32-bit unsigned aka Gauge32 */ + CUPS_ASN1_GET_REQUEST = 0xa0, /* GetRequest-PDU */ + CUPS_ASN1_GET_NEXT_REQUEST = 0xa1, /* GetNextRequest-PDU */ + CUPS_ASN1_GET_RESPONSE = 0xa2 /* GetResponse-PDU */ +} cups_asn1_t; + +typedef struct cups_snmp_s /**** SNMP data packet ****/ +{ + const char *error; /* Encode/decode error */ + http_addr_t address; /* Source address */ + int version; /* Version number */ + char community[CUPS_SNMP_MAX_STRING]; + /* Community name */ + cups_asn1_t request_type; /* Request type */ + int request_id; /* request-id value */ + int error_status; /* error-status value */ + int error_index; /* error-index value */ + int object_name[CUPS_SNMP_MAX_OID]; + /* object-name value */ + cups_asn1_t object_type; /* object-value type */ + union + { + int boolean; /* Boolean value */ + int integer; /* Integer value */ + unsigned counter; /* Counter value */ + unsigned gauge; /* Gauge value */ + int oid[CUPS_SNMP_MAX_OID]; /* OID value */ + char string[CUPS_SNMP_MAX_STRING];/* String value */ + } object_value; /* object-value value */ +} cups_snmp_t; + + +/* + * Prototypes... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + +extern void cupsSNMPClose(int fd) _CUPS_API_1_4; +extern int *cupsSNMPCopyOID(int *dst, const int *src, int dstsize) + _CUPS_API_1_4; +extern int cupsSNMPIsOID(cups_snmp_t *packet, const int *oid) + _CUPS_API_1_4; +extern int cupsSNMPIsOIDPrefixed(cups_snmp_t *packet, + const int *prefix) _CUPS_API_1_4; +extern int cupsSNMPOpen(void) _CUPS_API_1_4; +extern cups_snmp_t *cupsSNMPRead(int fd, cups_snmp_t *packet, int msec) + _CUPS_API_1_4; +extern void cupsSNMPSetDebug(int level) _CUPS_API_1_4; +extern int cupsSNMPWrite(int fd, http_addr_t *addr, int version, + const char *community, + cups_asn1_t request_type, + const unsigned request_id, + const int *oid) _CUPS_API_1_4; + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_SNMP_H_ */ + + +/* + * End of "$Id$". + */ diff --git a/cups/testcups.c b/cups/testcups.c index 68785d035..1ac4456bd 100644 --- a/cups/testcups.c +++ b/cups/testcups.c @@ -157,6 +157,7 @@ main(int argc, /* I - Number of command-line arguments */ { status = 1; puts("FAIL"); + return (1); } else puts("PASS"); diff --git a/cups/testsnmp.c b/cups/testsnmp.c new file mode 100644 index 000000000..7a3ccfc77 --- /dev/null +++ b/cups/testsnmp.c @@ -0,0 +1,224 @@ +/* + * "$Id$" + * + * SNMP test program for the Common UNIX Printing System (CUPS). + * + * Copyright 2008 by Apple Inc. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * main() - Main entry. + */ + +/* + * Include necessary headers... + */ + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include "string.h" +#include "snmp.h" + + +/* + * Local functions... + */ + +static int *scan_oid(char *s, int *oid, int oidsize); +static int show_oid(int fd, char *s, http_addr_t *addr); + + +/* + * 'main()' - Main entry. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line args */ + char *argv[]) /* I - Command-line arguments */ +{ + int i; /* Looping var */ + int fd; /* SNMP socket */ + http_addrlist_t *host; /* Address of host */ + + + if (argc < 2) + { + puts("Usage: ./testsnmp host-or-ip"); + return (1); + } + + if ((host = httpAddrGetList(argv[1], AF_UNSPEC, "161")) == NULL) + { + printf("Unable to find \"%s\"!\n", argv[1]); + return (1); + } + + fputs("cupsSNMPOpen: ", stdout); + + if ((fd = cupsSNMPOpen()) < 0) + { + printf("FAIL (%s)\n", strerror(errno)); + return (1); + } + + puts("PASS"); + + if (argc > 2) + { + /* + * Query OIDs from the command-line... + */ + + for (i = 2; i < argc; i ++) + if (!show_oid(fd, argv[i], &(host->addr))) + return (1); + } + else if (!show_oid(fd, (char *)"1.3.6.1.2.1.43.10.2.1.4.1.1", &(host->addr))) + return (1); + + return (0); +} + + +/* + * 'scan_oid()' - Scan an OID value. + */ + +static int * /* O - OID or NULL on error */ +scan_oid(char *s, /* I - OID string */ + int *oid, /* I - OID array */ + int oidsize) /* I - Size of OID array in integers */ +{ + int i; /* Index into OID array */ + char *ptr; /* Pointer into string */ + + + for (ptr = s, i = 0, oidsize --; ptr && *ptr && i < oidsize; i ++) + { + if (!isdigit(*ptr & 255)) + return (NULL); + + oid[i] = strtol(ptr, &ptr, 10); + if (*ptr == '.') + ptr ++; + } + + if (i >= oidsize) + return (NULL); + + oid[i] = 0; + + return (oid); +} + + +/* + * 'show_oid()' - Show the specified OID. + */ + +static int /* O - 1 on success, 0 on error */ +show_oid(int fd, /* I - SNMP socket */ + char *s, /* I - OID to query */ + http_addr_t *addr) /* I - Address to query */ +{ + int i; /* Looping var */ + int oid[255]; /* OID */ + cups_snmp_t packet; /* SNMP packet */ + + + printf("cupsSNMPWrite(%s): ", s); + + if (!scan_oid(s, oid, sizeof(oid) / sizeof(oid[0]))) + { + puts("FAIL (bad OID)"); + return (0); + } + + if (!cupsSNMPWrite(fd, addr, CUPS_SNMP_VERSION_1, "public", + CUPS_ASN1_GET_REQUEST, 1, oid)) + { + puts("FAIL"); + return (0); + } + + puts("PASS"); + + fputs("cupsSNMPRead(5000): ", stdout); + + if (!cupsSNMPRead(fd, &packet, 5000)) + { + puts("FAIL (timeout)"); + return (0); + } + + if (!cupsSNMPIsOID(&packet, oid)) + { + puts("FAIL (bad OID)"); + return (0); + } + + if (packet.error) + { + printf("FAIL (%s)\n", packet.error); + return (0); + } + + switch (packet.object_type) + { + case CUPS_ASN1_BOOLEAN : + printf("PASS (BOOLEAN %s)\n", + packet.object_value.boolean ? "TRUE" : "FALSE"); + break; + + case CUPS_ASN1_INTEGER : + printf("PASS (INTEGER %d)\n", packet.object_value.integer); + break; + + case CUPS_ASN1_BIT_STRING : + printf("PASS (BIT-STRING \"%s\")\n", packet.object_value.string); + break; + + case CUPS_ASN1_OCTET_STRING : + printf("PASS (OCTET-STRING \"%s\")\n", packet.object_value.string); + break; + + case CUPS_ASN1_NULL_VALUE : + puts("PASS (NULL-VALUE)"); + break; + + case CUPS_ASN1_OID : + printf("PASS (OID %d", packet.object_value.oid[0]); + for (i = 1; packet.object_value.oid[i]; i ++) + printf(".%d", packet.object_value.oid[i]); + puts(")"); + break; + + case CUPS_ASN1_COUNTER : + printf("PASS (Counter %d)\n", packet.object_value.counter); + break; + + case CUPS_ASN1_GAUGE: + printf("PASS (Gauge %u)\n", packet.object_value.gauge); + break; + + default : + printf("PASS (Unknown-%X)\n", packet.object_type); + break; + } + + return (1); +} + + +/* + * End of "$Id$". + */ diff --git a/cups/transcode.c b/cups/transcode.c index aab841642..036106edc 100644 --- a/cups/transcode.c +++ b/cups/transcode.c @@ -3,7 +3,7 @@ * * Transcoding support for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -132,8 +132,6 @@ _cupsCharmapFlush(void) vnext = vmap->next; free_vbcs_charmap(vmap); - - free(vmap); } vmap_cache = NULL; @@ -330,13 +328,8 @@ cupsCharsetToUTF8( if (encoding < CUPS_ENCODING_SBCS_END) bytes = conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding); - else if (encoding < CUPS_ENCODING_VBCS_END) - bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding); else - { - DEBUG_puts(" Bad encoding, returning -1"); - bytes = -1; - } + bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding); #ifdef HAVE_PTHREAD_H pthread_mutex_unlock(&map_mutex); @@ -437,10 +430,8 @@ cupsUTF8ToCharset( if (encoding < CUPS_ENCODING_SBCS_END) bytes = conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding); - else if (encoding < CUPS_ENCODING_VBCS_END) - bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding); else - bytes = -1; + bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding); #ifdef HAVE_PTHREAD_H pthread_mutex_unlock(&map_mutex); @@ -1468,6 +1459,8 @@ get_vbcs_charmap( { DEBUG_puts(" Unable to get charmap count!"); + cupsFileClose(fp); + return (NULL); } @@ -1479,9 +1472,10 @@ get_vbcs_charmap( if ((vmap = (_cups_vmap_t *)calloc(1, sizeof(_cups_vmap_t))) == NULL) { - cupsFileClose(fp); DEBUG_puts(" Unable to allocate memory!"); + cupsFileClose(fp); + return (NULL); } diff --git a/cups/util.c b/cups/util.c index 33ba35053..6dea98085 100644 --- a/cups/util.c +++ b/cups/util.c @@ -984,9 +984,6 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or CUPS_HTTP_DEFAULT */ close(fd); - if (http2 != http) - httpClose(http2); - /* * See if we actually got the file or an error... */ @@ -1015,6 +1012,9 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or CUPS_HTTP_DEFAULT */ unlink(cg->ppd_filename); } + if (http2 != http) + httpClose(http2); + /* * Return the PPD file... */ |