mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
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 commit is contained in:
parent
78e904c27b
commit
8c3fd1908d
@ -446,6 +446,7 @@ static void standard_sub_advanced(int snum, const char *user,
|
||||
string_sub(p,"%P", connectpath, l);
|
||||
break;
|
||||
case 'S':
|
||||
if ( snum != -1 )
|
||||
string_sub(p,"%S", lp_servicename(snum), l);
|
||||
break;
|
||||
case 'g':
|
||||
@ -463,6 +464,7 @@ 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':
|
||||
if ( snum != -1 )
|
||||
string_sub(p,"%p", automount_path(lp_servicename(snum)), l);
|
||||
break;
|
||||
case '\0':
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user