summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
commit87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 (patch)
tree3c302f710cbaa03e3c0d46549e8982771b12b8a5 /source3/printing
parent9e9e73303ec10a64bd744b9b33f4e6cd7d394f03 (diff)
downloadsamba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.gz
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.bz2
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.zip
The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c8
-rw-r--r--source3/printing/pcap.c4
-rw-r--r--source3/printing/print_cups.c9
-rw-r--r--source3/printing/print_generic.c6
-rw-r--r--source3/printing/print_svid.c4
-rw-r--r--source3/printing/printing.c17
6 files changed, 13 insertions, 35 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 5e28f3e5b6..d099c29cc1 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -288,7 +288,6 @@ int write_ntforms(nt_forms_struct **list, int number)
(*list)[i].bottom);
if (len > sizeof(buf)) break;
slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[i].name);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
kbuf.dsize = strlen(key)+1;
kbuf.dptr = key;
dbuf.dsize = len;
@@ -371,7 +370,6 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32
}
slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[n].name);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
kbuf.dsize = strlen(key)+1;
kbuf.dptr = key;
if (tdb_delete(tdb, kbuf) != 0) {
@@ -1461,7 +1459,6 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver)
}
slprintf(key, sizeof(key)-1, "%s%s/%d/%s", DRIVERS_PREFIX, architecture, driver->cversion, driver->name);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
DEBUG(5,("add_a_printer_driver_3: Adding driver with key %s\n", key ));
@@ -1826,7 +1823,6 @@ uint32 del_a_printer(char *sharename)
TDB_DATA kbuf;
slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, sharename);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
kbuf.dptr=key;
kbuf.dsize=strlen(key)+1;
@@ -1913,7 +1909,6 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, info->sharename);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
kbuf.dptr = key;
kbuf.dsize = strlen(key)+1;
@@ -2287,7 +2282,7 @@ static void map_to_os2_driver(fstring drivername)
return;
}
- lines = file_lines_load(mapfile, &numlines, True);
+ lines = file_lines_load(mapfile, &numlines);
if (numlines == 0) {
DEBUG(0,("No entries in OS/2 driver map %s\n",mapfile));
return;
@@ -2439,7 +2434,6 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
ZERO_STRUCT(info);
slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, sharename);
- dos_to_unix(key, True); /* Convert key to unix-codepage */
kbuf.dptr = key;
kbuf.dsize = strlen(key)+1;
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index e9c2e46090..1f909d3533 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -296,8 +296,6 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname)
if (*line == '#' || *line == 0)
continue;
- unix_to_dos(line,True);
-
/* now we have a real printer line - cut it off at the first : */
p = strchr(line,':');
if (p) *p = 0;
@@ -383,8 +381,6 @@ void pcap_printer_fn(void (*fn)(char *, char *))
p = strchr(line,':');
if (p) *p = 0;
- unix_to_dos(line,True);
-
/* now find the most likely printer name and comment
this is pure guesswork, but it's better than nothing */
*name = 0;
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 3ca0af537f..b9929c4823 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -198,9 +198,11 @@ cups_printer_fn(void (*fn)(char *, char *)) /* I - Function to call */
break;
if (info == NULL || !info[0])
- (*fn)(unix_to_dos(name,False), make_model);
+ (*fn)(name, make_model);
else
- (*fn)(unix_to_dos(name,False), info);
+ (*fn)(name,info);
+
+
}
ippDelete(response);
@@ -268,8 +270,7 @@ cups_printername_ok(char *name) /* I - Name of printer */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requested-attributes", NULL, "printer-uri");
- slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
- dos_to_unix(name, False));
+ slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index ef38d26493..3e5753583e 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -83,8 +83,6 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
pstring_sub(syscmd, "%p", p);
standard_sub_snum(snum,syscmd);
- /* Convert script args to unix-codepage */
- dos_to_unix(syscmd, True);
ret = smbrun(syscmd,outfd);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
@@ -195,9 +193,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
print_queue_struct *queue = NULL;
fstring printer_name;
- /* Convert printer name (i.e. share name) to unix-codepage */
fstrcpy(printer_name, lp_servicename(snum));
- dos_to_unix(printer_name, True);
print_run_command(snum, lp_lpqcommand(snum), &fd, NULL);
@@ -208,7 +204,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines, True);
+ qlines = fd_lines_load(fd, &numlines);
close(fd);
/* turn the lpq output into a series of job structures */
diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c
index 58a1d03f49..301f388671 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, False);
+ lines = file_lines_pload("/usr/bin/lpstat -v", NULL);
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)(unix_to_dos(tmp->name,False), "");
+ (fn)(tmp->name, "");
}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index aab4c2f43f..d0a07ccb4c 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -255,7 +255,6 @@ static void print_cache_flush(int snum)
{
fstring key;
slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum));
- dos_to_unix(key, True); /* Convert key to unix-codepage */
tdb_store_int(tdb, key, -1);
}
@@ -328,10 +327,7 @@ static void print_queue_update(int snum)
fstring keystr, printer_name, cachestr;
TDB_DATA data, key;
- /* Convert printer name (i.e. share name) to unix-codepage for all of the
- * following tdb key generation */
fstrcpy(printer_name, lp_servicename(snum));
- dos_to_unix(printer_name, True);
/*
* Check to see if someone else is doing this update.
@@ -598,11 +594,9 @@ static BOOL is_owner(struct current_user *user, int jobid)
if (!pjob || !user) return False;
if ((vuser = get_valid_user_struct(user->vuid)) != NULL) {
- return strequal(pjob->user,
- unix_to_dos(vuser->user.smb_name,False));
+ return strequal(pjob->user, vuser->user.smb_name);
} else {
- return strequal(pjob->user,
- unix_to_dos(uidtoname(user->uid),False));
+ return strequal(pjob->user, uidtoname(user->uid));
}
}
@@ -752,7 +746,6 @@ static BOOL print_cache_expired(int snum)
time_t t2, t = time(NULL);
slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum));
- dos_to_unix(key, True); /* Convert key to unix-codepage */
t2 = tdb_fetch_int(tdb, key);
if (t2 == ((time_t)-1) || (t - t2) >= lp_lpqcachetime()) {
DEBUG(3, ("print cache expired\n"));
@@ -771,7 +764,6 @@ static int get_queue_status(int snum, print_status_struct *status)
ZERO_STRUCTP(status);
slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum));
- dos_to_unix(keystr, True); /* Convert key to unix-codepage */
key.dptr = keystr;
key.dsize = strlen(keystr);
data = tdb_fetch(tdb, key);
@@ -888,9 +880,9 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
fstrcpy(pjob.jobname, jobname);
if ((vuser = get_valid_user_struct(user->vuid)) != NULL) {
- fstrcpy(pjob.user, unix_to_dos(vuser->user.smb_name,False));
+ fstrcpy(pjob.user, vuser->user.smb_name);
} else {
- fstrcpy(pjob.user, unix_to_dos(uidtoname(user->uid),False));
+ fstrcpy(pjob.user, uidtoname(user->uid));
}
fstrcpy(pjob.qname, lp_servicename(snum));
@@ -1128,7 +1120,6 @@ int print_queue_status(int snum,
*/
ZERO_STRUCTP(status);
slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum));
- dos_to_unix(keystr, True); /* Convert key to unix-codepage */
key.dptr = keystr;
key.dsize = strlen(keystr);
data = tdb_fetch(tdb, key);