diff options
author | Tim Potter <tpot@samba.org> | 2001-12-10 05:03:17 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-12-10 05:03:17 +0000 |
commit | 4f53486d78102d8080293eeafd7b4ed701d81a2e (patch) | |
tree | 2aaca817b8f8dbbb1fb09abff6ad482398b7dd1d /source3/rpc_server | |
parent | ce654f5e557544451fb198b32af89152a2aeed60 (diff) | |
download | samba-4f53486d78102d8080293eeafd7b4ed701d81a2e.tar.gz samba-4f53486d78102d8080293eeafd7b4ed701d81a2e.tar.bz2 samba-4f53486d78102d8080293eeafd7b4ed701d81a2e.zip |
Added client and server code for the GetPrintProcessorDirectory SPOOLSS
rpc. This was supposed to fix a printer driver download bug but it didn't
but it seemed a shame to trash all this code so I'm commiting it #ifdef'ed
out in case someone needs it one day.
(This used to be commit bef43656471741c6c10b12e7516c15de9ae76394)
Diffstat (limited to 'source3/rpc_server')
-rwxr-xr-x | source3/rpc_server/srv_spoolss.c | 40 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 86 |
2 files changed, 125 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 3a056dcb65..e71bcd36a9 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -1316,6 +1316,40 @@ static BOOL api_spoolss_enumprinterdataex(pipes_struct *p) return True; } +/**************************************************************************** +****************************************************************************/ + +/* Disabled because it doesn't fix the bug I am looking at but it would be + a shame to throw away the code. -tpot */ + +#if 0 + +static BOOL api_spoolss_getprintprocessordirectory(pipes_struct *p) +{ + SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u; + SPOOL_R_GETPRINTPROCESSORDIRECTORY r_u; + prs_struct *data = &p->in_data.data; + prs_struct *rdata = &p->out_data.rdata; + + ZERO_STRUCT(q_u); + ZERO_STRUCT(r_u); + + if(!spoolss_io_q_getprintprocessordirectory("", &q_u, data, 0)) { + DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n")); + return False; + } + + r_u.status = _spoolss_getprintprocessordirectory(p, &q_u, &r_u); + + if(!spoolss_io_r_getprintprocessordirectory("", &r_u, rdata, 0)) { + DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n")); + return False; + } + + return True; +} + +#endif /******************************************************************* \pipe\spoolss commands @@ -1367,7 +1401,11 @@ struct api_struct api_spoolss_cmds[] = {"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex }, {"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey }, {"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex }, - +#if 0 + /* Disabled because it doesn't fix the bug I am looking at but it would be + a shame to throw away the code. -tpot */ + {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory}, +#endif { NULL, 0, NULL } }; diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 0e98498fe3..dae3aa09c9 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -7,6 +7,7 @@ * Copyright (C) Jean François Micouleau 1998-2000. * Copyright (C) Jeremy Allison 2001. * Copyright (C) Gerald Carter 2000-2001. + * Copyright (C) Tim Potter 2001. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -7073,4 +7074,89 @@ done: return result; } +/**************************************************************************** +****************************************************************************/ + +/* Disabled because it doesn't fix the bug I am looking at but it would be + a shame to throw away the code. -tpot */ + +#if 0 + +static void fill_printprocessordirectory_1(PRINTPROCESSOR_DIRECTORY_1 *info, char *name) +{ + init_unistr(&info->name, name); +} + +static WERROR getprintprocessordirectory_level_1(UNISTR2 *name, + UNISTR2 *environment, + NEW_BUFFER *buffer, + uint32 offered, + uint32 *needed) +{ + pstring path; + pstring long_archi; + pstring short_archi; + PRINTPROCESSOR_DIRECTORY_1 *info=NULL; + + unistr2_to_ascii(long_archi, environment, sizeof(long_archi)-1); + + if (get_short_archi(short_archi, long_archi)==FALSE) + return WERR_INVALID_ENVIRONMENT; + + if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL) + return WERR_NOMEM; + + /* Not sure what to return here - are UNC names valid here?. + Windows returns the string: C:\WINNT\System32\spool\PRTPROCS\W32X86 + which is pretty bogus for a RPC. */ + + slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", global_myname, short_archi); + + DEBUG(4,("print processor directory: [%s]\n", path)); + + fill_printprocessordirectory_1(info, path); + + *needed += spoolss_size_printprocessordirectory_info_1(info); + + if (!alloc_buffer_size(buffer, *needed)) { + safe_free(info); + return WERR_INSUFFICIENT_BUFFER; + } + + smb_io_printprocessordirectory_1("", buffer, info, 0); + safe_free(info); + + if (*needed > offered) + return WERR_INSUFFICIENT_BUFFER; + else + return WERR_OK; +} + +WERROR _spoolss_getprintprocessordirectory(pipes_struct *p, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u) +{ + uint32 level = q_u->level; + NEW_BUFFER *buffer = NULL; + uint32 offered = q_u->offered; + uint32 *needed = &r_u->needed; + + /* that's an [in out] buffer */ + spoolss_move_buffer(q_u->buffer, &r_u->buffer); + buffer = r_u->buffer; + + DEBUG(5,("_spoolss_getprintprocessordirectory\n")); + + *needed=0; + + switch(level) { + case 1: + return getprintprocessordirectory_level_1 + (&q_u->name, &q_u->environment, buffer, offered, needed); + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_ACCESS_DENIED; +} + +#endif |