summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-10-18 19:57:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:59 -0500
commitc53e6401eb3de7fa4abc85c25f8672b624cf2c66 (patch)
tree8577b52d10dc7cc3e03ceffd7f8c7666acb896a1
parentb0202c7b851bb15f856ba526857e8b2f7cfabfec (diff)
downloadsamba-c53e6401eb3de7fa4abc85c25f8672b624cf2c66.tar.gz
samba-c53e6401eb3de7fa4abc85c25f8672b624cf2c66.tar.bz2
samba-c53e6401eb3de7fa4abc85c25f8672b624cf2c66.zip
r3049: fixing some calls in the printing code to stanard_sub_basic(); fix standard_sub_snum() to use the current user's gid; add some (snum == -1) checks to standard_sub_advanced()
(This used to be commit 8c3fd1908d201e9891878ff4c3259ed9690dff97)
-rw-r--r--source3/lib/substitute.c8
-rw-r--r--source3/printing/nt_printing.c2
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c6
-rw-r--r--source3/smbd/lanman.c17
4 files changed, 19 insertions, 14 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 44e791b790..92eff625f3 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -446,7 +446,8 @@ static void standard_sub_advanced(int snum, const char *user,
string_sub(p,"%P", connectpath, l);
break;
case 'S':
- string_sub(p,"%S", lp_servicename(snum), l);
+ if ( snum != -1 )
+ string_sub(p,"%S", lp_servicename(snum), l);
break;
case 'g':
string_sub(p,"%g", gidtoname(gid), l);
@@ -463,7 +464,8 @@ static void standard_sub_advanced(int snum, const char *user,
* "path =" string in [homes] and so needs the
* service name, not the username. */
case 'p':
- string_sub(p,"%p", automount_path(lp_servicename(snum)), l);
+ if ( snum != -1 )
+ string_sub(p,"%p", automount_path(lp_servicename(snum)), l);
break;
case '\0':
p++;
@@ -797,6 +799,6 @@ void standard_sub_snum(int snum, char *str, size_t len)
cached_uid = current_user.uid;
}
- standard_sub_advanced(snum, cached_user, "", -1,
+ standard_sub_advanced(snum, cached_user, "", current_user.gid,
smb_user_name, str, len);
}
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 8a67bfaed4..14c0417f77 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -4080,7 +4080,7 @@ WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_print
fstrcpy( servername, print_hnd->servername );
else {
fstrcpy( servername, "%L" );
- standard_sub_basic( NULL, servername, sizeof(servername)-1 );
+ standard_sub_basic( "", servername, sizeof(servername)-1 );
}
/*
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index c882cea59b..2bdcfeff4d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2766,7 +2766,7 @@ void spoolss_notify_server_name(int snum,
uint32 len;
fstrcpy( temp_name, "\\\\%L" );
- standard_sub_basic( NULL, temp_name, sizeof(temp_name)-1 );
+ standard_sub_basic( "", temp_name, sizeof(temp_name)-1 );
len = rpcstr_push(temp, temp_name, sizeof(temp)-2, STR_TERMINATE);
@@ -6623,7 +6623,7 @@ WERROR _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u
return WERR_BADFID;
}
- if (!print_job_exists(snum, jobid)) {
+ if (!print_job_exists(lp_const_servicename(snum), jobid)) {
return WERR_INVALID_PRINTER_NAME;
}
@@ -8640,7 +8640,7 @@ static WERROR getjob_level_2(print_queue_struct **queue, int count, int snum,
* a failure condition
*/
- if ( !(nt_devmode=print_job_devmode( snum, jobid )) )
+ if ( !(nt_devmode=print_job_devmode( lp_const_servicename(snum), jobid )) )
devmode = construct_dev_mode(snum);
else {
if ((devmode = (DEVICEMODE *)malloc(sizeof(DEVICEMODE))) != NULL) {
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 8b07f0e305..610ee45120 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -441,7 +441,7 @@ static void fill_printjob_info(connection_struct *conn, int snum, int uLevel,
/* the client expects localtime */
t -= TimeDiff(t);
- PACKI(desc,"W",pjobid_to_rap(snum,queue->job)); /* uJobId */
+ PACKI(desc,"W",pjobid_to_rap(lp_const_servicename(snum),queue->job)); /* uJobId */
if (uLevel == 1) {
PACKS(desc,"B21",queue->fs_user); /* szUserName */
PACKS(desc,"B",""); /* pad */
@@ -549,7 +549,7 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
PACKS(desc, "z", driver.info_3->monitorname); /* language monitor */
fstrcpy(location, "\\\\%L\\print$\\WIN40\\0");
- standard_sub_basic( NULL, location, sizeof(location)-1 );
+ standard_sub_basic( "", location, sizeof(location)-1 );
PACKS(desc,"z", location); /* share to retrieve files */
PACKS(desc,"z", driver.info_3->defaultdatatype); /* default data type */
@@ -2122,11 +2122,12 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid, char *param
char *p = skip_string(str2,1);
uint32 jobid;
int snum;
+ fstring sharename;
int errcode;
extern struct current_user current_user;
WERROR werr = WERR_OK;
- if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid))
+ if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid))
return False;
/* check it's a supported varient */
@@ -2137,7 +2138,7 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid, char *param
*rparam = REALLOC(*rparam,*rparam_len);
*rdata_len = 0;
- if (!print_job_exists(snum, jobid)) {
+ if (!print_job_exists(sharename, jobid)) {
errcode = NERR_JobNotFound;
goto out;
}
@@ -2257,11 +2258,12 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha
char *p = skip_string(str2,1);
uint32 jobid;
int snum;
+ fstring sharename;
int uLevel = SVAL(p,2);
int function = SVAL(p,4);
int place, errcode;
- if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid))
+ if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid))
return False;
*rparam_len = 4;
*rparam = REALLOC(*rparam,*rparam_len);
@@ -2273,7 +2275,7 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha
(!check_printjob_info(&desc,uLevel,str2)))
return(False);
- if (!print_job_exists(snum, jobid)) {
+ if (!print_job_exists(sharename, jobid)) {
errcode=NERR_JobNotFound;
goto out;
}
@@ -2939,6 +2941,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
int count;
int i;
int snum;
+ fstring sharename;
uint32 jobid;
struct pack_desc desc;
print_queue_struct *queue=NULL;
@@ -2956,7 +2959,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
if (strcmp(str1,"WWrLh") != 0) return False;
if (!check_printjob_info(&desc,uLevel,str2)) return False;
- if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid))
+ if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid))
return False;
if (snum < 0 || !VALID_SNUM(snum)) return(False);