summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-08-09 20:14:29 +0000
committerGerald Carter <jerry@samba.org>2000-08-09 20:14:29 +0000
commita08d4448964641150cad0e6b3fb0055602ef79be (patch)
tree42eccb835f29754e1f9eafff5d0718e60994cd46 /source3/rpcclient
parente3048cfc0b324ec5ab825efe87eaa97cc9504c09 (diff)
downloadsamba-a08d4448964641150cad0e6b3fb0055602ef79be.tar.gz
samba-a08d4448964641150cad0e6b3fb0055602ef79be.tar.bz2
samba-a08d4448964641150cad0e6b3fb0055602ef79be.zip
More work on AddPrinterDriver() and AddPrinterEx() client RPC's
Also fixed init_unistr() to deal with a NULL source character string. -jerry (This used to be commit 8ecd5dd52a6bd867f5d117352048ee43ce7254d9)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c84
1 files changed, 40 insertions, 44 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 5751c1e227..2844df8dd8 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -778,6 +778,30 @@ void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch)
return;
}
+/**************************************************************************
+ wrapper for strtok to get the next parameter from a delimited list.
+ Needed to handle the empty parameter string denoted by "NULL"
+ *************************************************************************/
+static char* get_driver_3_param (char* str, char* delim, UNISTR* dest)
+{
+ char *ptr;
+
+ /* get the next token */
+ ptr = strtok(str, delim);
+
+ /* a string of 'NULL' is used to represent an empty
+ parameter because two consecutive delimiters
+ will not return an empty string. See man strtok(3)
+ for details */
+ if (StrCaseCmp(ptr, "NULL") == 0)
+ ptr = NULL;
+
+ if (dest != NULL)
+ init_unistr(dest, ptr);
+
+ return ptr;
+}
+
/********************************************************************************
fill in the members of a DRIVER_INFO_3 struct using a character
string in the form of
@@ -790,52 +814,21 @@ BOOL init_drv_info_3_members (DRIVER_INFO_3 *info, char *args)
char *str, *str2;
uint32 len, i;
- /* <Long Printer Name> */
- if ((str = strtok(args, ":")) == NULL)
- return False;
- else
- init_unistr(&info->name, str);
-
- /* <Driver File Name> */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->driverpath, str);
-
- /* <Data File Name > */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->datafile, str);
-
- /* <Config File Name> */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->configfile, str);
-
- /* <Help File Name> */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->helpfile, str);
-
- /* <Language Monitor Name> */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->monitorname, str);
-
- /* <Default Data Type> */
- if ((str = strtok(NULL, ":")) == NULL)
- return False;
- else
- init_unistr(&info->defaultdatatype, str);
+ /* fill in the UNISTR fields */
+ str = get_driver_3_param (args, ":", &info->name);
+ str = get_driver_3_param (NULL, ":", &info->driverpath);
+ str = get_driver_3_param (NULL, ":", &info->datafile);
+ str = get_driver_3_param (NULL, ":", &info->configfile);
+ str = get_driver_3_param (NULL, ":", &info->helpfile);
+ str = get_driver_3_param (NULL, ":", &info->monitorname);
+ str = get_driver_3_param (NULL, ":", &info->defaultdatatype);
/* <Comma Separated List of Dependent Files> */
- str = strtok(NULL, ":"); /* get the list of dependent files */
- str2 = str; /* save the beginning of the string */
- str = strtok(str, ","); /* begin to strip out each filename */
+ str2 = get_driver_3_param (NULL, ":", NULL); /* save the beginning of the string */
+ str = str2;
+
+ /* begin to strip out each filename */
+ str = strtok(str, ",");
len = 0;
while (str != NULL)
{
@@ -874,3 +867,6 @@ void free_drv_info_3 (DRIVER_INFO_3 *info)
return;
}
+
+
+