diff options
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/lib/util_file.c | 21 | ||||
-rw-r--r-- | source3/param/loadparm.c | 4 | ||||
-rw-r--r-- | source3/printing/print_cups.c | 4 | ||||
-rw-r--r-- | source3/printing/print_svid.c | 4 | ||||
-rw-r--r-- | source3/printing/printing.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 6 | ||||
-rw-r--r-- | source3/smbd/dfree.c | 2 | ||||
-rw-r--r-- | source3/smbd/groupname.c | 2 | ||||
-rw-r--r-- | source3/smbd/lanman.c | 6 | ||||
-rw-r--r-- | source3/smbd/password.c | 2 |
12 files changed, 33 insertions, 26 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 62d978ee7a5..5c8adc8ca46 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -444,8 +444,8 @@ int getfileline(void *vp, char *linebuf, int linebuf_size); char *fgets_slash(char *s2,int maxlen,FILE *f); char *file_pload(char *syscmd, size_t *size); char *file_load(char *fname, size_t *size); -char **file_lines_load(char *fname, int *numlines); -char **file_lines_pload(char *syscmd, int *numlines); +char **file_lines_load(char *fname, int *numlines, BOOL convert); +char **file_lines_pload(char *syscmd, int *numlines, BOOL convert); void file_lines_free(char **lines); void file_lines_slashcont(char **lines); diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 33a687950d4..1184dd0634e 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -405,7 +405,7 @@ char *file_load(char *fname, size_t *size) /**************************************************************************** parse a buffer into lines ****************************************************************************/ -static char **file_lines_parse(char *p, size_t size, int *numlines) +static char **file_lines_parse(char *p, size_t size, int *numlines, BOOL convert) { int i; char *s, **ret; @@ -434,15 +434,21 @@ static char **file_lines_parse(char *p, size_t size, int *numlines) if (s[0] == '\r') s[0] = 0; } + if (convert) { + for (i = 0; i < *numlines; i++) + unix_to_dos(ret[i], True); + } + return ret; } /**************************************************************************** load a file into memory and return an array of pointers to lines in the file -must be freed with file_lines_free() +must be freed with file_lines_free(). If convert is true calls unix_to_dos on +the list. ****************************************************************************/ -char **file_lines_load(char *fname, int *numlines) +char **file_lines_load(char *fname, int *numlines, BOOL convert) { char *p; size_t size; @@ -450,15 +456,16 @@ char **file_lines_load(char *fname, int *numlines) p = file_load(fname, &size); if (!p) return NULL; - return file_lines_parse(p, size, numlines); + return file_lines_parse(p, size, numlines, convert); } /**************************************************************************** load a pipe into memory and return an array of pointers to lines in the data -must be freed with file_lines_free() +must be freed with file_lines_free(). If convert is true calls unix_to_dos on +the list. ****************************************************************************/ -char **file_lines_pload(char *syscmd, int *numlines) +char **file_lines_pload(char *syscmd, int *numlines, BOOL convert) { char *p; size_t size; @@ -466,7 +473,7 @@ char **file_lines_pload(char *syscmd, int *numlines) p = file_pload(syscmd, &size); if (!p) return NULL; - return file_lines_parse(p, size, numlines); + return file_lines_parse(p, size, numlines, convert); } /**************************************************************************** diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b666cd3cf41..4a6ec836074 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2217,11 +2217,11 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr) if (*p == '|') { - lines = file_lines_pload(p + 1, NULL); + lines = file_lines_pload(p + 1, NULL, True); } else { - lines = file_lines_load(fname, NULL); + lines = file_lines_load(fname, NULL, True); } if (!lines) diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index fff135e2a2a..1e45df0c63e 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -121,7 +121,7 @@ void cups_printer_fn(void (*fn)(char *, char *)) if (name == NULL) break; - (*fn)(name, make_model); + (*fn)(unix_to_dos(name,False), make_model); } ippDelete(response); @@ -171,7 +171,7 @@ int cups_printername_ok(char *name) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); - snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", name); + snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dos_to_unix(name,False)); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index 301f3886719..58a1d03f498 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -50,7 +50,7 @@ static void populate_printers(void) char **lines; int i; - lines = file_lines_pload("/usr/bin/lpstat -v", NULL); + lines = file_lines_pload("/usr/bin/lpstat -v", NULL, False); if (!lines) return; for (i=0;lines[i];i++) { @@ -107,7 +107,7 @@ void sysv_printer_fn(void (*fn)(char *, char *)) if (printers == NULL) populate_printers(); for (tmp = printers; tmp != NULL; tmp = tmp->next) - (fn)(tmp->name, ""); + (fn)(unix_to_dos(tmp->name,False), ""); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 68c371547f3..e8dc4d7f341 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -339,7 +339,7 @@ static void print_queue_update(int snum) print_run_command(snum, cmd, tmp_file, NULL); numlines = 0; - qlines = file_lines_load(tmp_file, &numlines); + qlines = file_lines_load(tmp_file, &numlines, True); unlink(tmp_file); /* turn the lpq output into a series of job structures */ diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index ed3cf7df827..352852038ab 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -128,7 +128,7 @@ static char *unmap_unixname(char *unix_user_name, int name_idx) if (!*unix_user_name) return NULL; if (!*mapfile) return NULL; - lines = file_lines_load(mapfile, NULL); + lines = file_lines_load(mapfile, NULL,False); if (!lines) { DEBUG(0,("unmap_unixname: can't open username map %s\n", mapfile)); return NULL; diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 1ef6a8c11ba..69cb79156b3 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -3480,7 +3480,7 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer) } numlines = 0; - qlines = file_lines_load(tmp_file, &numlines); + qlines = file_lines_load(tmp_file, &numlines, True); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); DEBUGADD(10,("Unlinking port file [%s]\n", tmp_file)); unlink(tmp_file); @@ -4604,7 +4604,7 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need } numlines = 0; - qlines = file_lines_load(tmp_file, &numlines); + qlines = file_lines_load(tmp_file, &numlines,True); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); DEBUGADD(10,("Unlinking port file [%s]\n", tmp_file)); unlink(tmp_file); @@ -4702,7 +4702,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need } numlines = 0; - qlines = file_lines_load(tmp_file, &numlines); + qlines = file_lines_load(tmp_file, &numlines,True); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); DEBUGADD(10,("Unlinking port file [%s]\n", tmp_file)); unlink(tmp_file); diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c index ee5722acd57..c8c44371554 100644 --- a/source3/smbd/dfree.c +++ b/source3/smbd/dfree.c @@ -91,7 +91,7 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query, slprintf(syscmd, sizeof(syscmd), "%s %s", dfree_command, path); DEBUG (3, ("disk_free: Running command %s\n", syscmd)); - lines = file_lines_pload(syscmd, NULL); + lines = file_lines_pload(syscmd, NULL, True); if (lines) { char *line = lines[0]; if (strlen(line) > 0) diff --git a/source3/smbd/groupname.c b/source3/smbd/groupname.c index d53fa56a44f..d44e9a7a39c 100644 --- a/source3/smbd/groupname.c +++ b/source3/smbd/groupname.c @@ -101,7 +101,7 @@ void load_groupname_map(void) * Load the file. */ - lines = file_lines_load(groupname_map_file,NULL); + lines = file_lines_load(groupname_map_file,NULL,False); if (!lines) { DEBUG(0,("load_groupname_map: can't open groupname map %s. Error was %s\n", groupname_map_file, strerror(errno))); diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 1e461f10a92..c9193db4a83 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -544,7 +544,7 @@ static void fill_printq_info_52(connection_struct *conn, int snum, int uLevel, DEBUG(10,("snum: %d\nlp_printerdriver: [%s]\nlp_driverfile: [%s]\n", snum, lp_printerdriver(snum), lp_driverfile(snum))); - lines = file_lines_load(lp_driverfile(snum),NULL); + lines = file_lines_load(lp_driverfile(snum),NULL, False); if (!lines) { DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum), @@ -785,7 +785,7 @@ static int get_printerdrivernumber(int snum) DEBUG(10,("snum: %d\nlp_printerdriver: [%s]\nlp_driverfile: [%s]\n", snum, lp_printerdriver(snum), lp_driverfile(snum))); - lines = file_lines_load(lp_driverfile(snum), NULL); + lines = file_lines_load(lp_driverfile(snum), NULL, False); if (!lines) { DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum),strerror(errno))); @@ -1089,7 +1089,7 @@ static int get_server_info(uint32 servertype, BOOL local_list_only; int i; - lines = file_lines_load(lock_path(SERVER_LIST), NULL); + lines = file_lines_load(lock_path(SERVER_LIST), NULL, False); if (!lines) { DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno))); return(0); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index f759f3b781c..f9657eb9ee3 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -854,7 +854,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file) int plus_allowed = 1; char *file_host; char *file_user; - char **lines = file_lines_load(equiv_file, NULL); + char **lines = file_lines_load(equiv_file, NULL, False); int i; DEBUG(5, ("check_user_equiv %s %s %s\n", user, remote, equiv_file)); |