diff options
author | Luke Leighton <lkcl@samba.org> | 1999-12-12 01:25:49 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-12-12 01:25:49 +0000 |
commit | 0ce128e3550794d4dbbd1def00e87c020f72c992 (patch) | |
tree | 9ff25319ff380a5bb219788d8a116ff5110a3343 /source3/printing | |
parent | 12ca139d5cb79f7e61a84d7dfe8a4c64ed56d82b (diff) | |
download | samba-0ce128e3550794d4dbbd1def00e87c020f72c992.tar.gz samba-0ce128e3550794d4dbbd1def00e87c020f72c992.tar.bz2 samba-0ce128e3550794d4dbbd1def00e87c020f72c992.zip |
delineation between smb and msrpc more marked. smbd now constructs
pdus, and then feeds them over either a "local" function call or a "remote"
function call to an msrpc service. the "remote" msrpc daemon, on the
other side of a unix socket, then calls the same "local" function that
smbd would, if the msrpc service were being run from inside smbd.
this allows a transition from local msrpc services (inside the same smbd
process) to remote (over a unix socket).
removed reference to pipes_struct in msrpc services. all msrpc processing
functions take rpcsrv_struct which is a structure containing state info
for the msrpc functions to decode and create pdus.
created become_vuser() which does everything not related to connection_struct
that become_user() does.
removed, as best i could, connection_struct dependencies from the nt spoolss
printing code.
todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific
info on a per-connection basis, and if the connection dies then so does
the info, and that's a fairly serious problem.
had to put pretty much everything that is in user_struct into parse_creds.c
to feed unix user info over to the msrpc daemons. why? because it's
expensive to do unix password/group database lookups, and it's definitely
expensive to do nt user profile lookups, not to mention pretty difficult
and if you did either of these it would introduce a complication /
unnecessary interdependency. so, send uid/gid/num_groups/gid_t* +
SID+num_rids+domain_group_rids* + unix username + nt username + nt domain
+ user session key etc. this is the MINIMUM info identified so far that's
actually implemented. missing bits include the called and calling
netbios names etc. (basically, anything that can be loaded into
standard_sub() and standard_sub_basic()...)
(This used to be commit aa3c659a8dba0437c17c60055a6ed30fdfecdb6d)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 13 | ||||
-rw-r--r-- | source3/printing/printing.c | 58 |
2 files changed, 51 insertions, 20 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 90a53f1f7c..d58ead0f93 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -199,9 +199,9 @@ get the nt drivers list open the directory and look-up the matching names ****************************************************************************/ -int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture) +int get_ntdrivers(fstring **list, char *architecture) { - void *dirp; + DIR *dirp; char *dpname; fstring name_match; fstring short_archi; @@ -212,9 +212,9 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture) DEBUG(5,("Getting the driver list from directory: [%s]\n", lp_nt_drivers_file())); *list=NULL; - dirp = OpenDir(conn, lp_nt_drivers_file(), False); + dirp = opendir(lp_nt_drivers_file()); - if (!dirp) + if (dirp == NULL) { DEBUG(0,("Error opening driver directory [%s]\n",lp_nt_drivers_file())); return(-1); @@ -224,8 +224,7 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture) slprintf(name_match, sizeof(name_match)-1, "NTdriver_%s_", short_archi); match_len=strlen(name_match); - - while ((dpname = ReadDirName(dirp)) != NULL) + while ((dpname = readdirname(dirp)) != NULL) { if (strncmp(dpname, name_match, match_len)==0) { @@ -240,7 +239,7 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture) } } - CloseDir(dirp); + closedir(dirp); return(total); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index dc28f17615..e1fb53f40d 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -49,11 +49,10 @@ Build the print command in the supplied buffer. This means getting the print command for the service and inserting the printer name and the print file name. Return NULL on error, else the passed buffer pointer. ****************************************************************************/ -static char *build_print_command(connection_struct *conn, +static char *build_print_command(connection_struct *conn, int snum, char *command, char *syscmd, char *filename1) { - int snum = SNUM(conn); char *tstr; pstring filename; @@ -93,8 +92,15 @@ static char *build_print_command(connection_struct *conn, string_sub(syscmd, "%p", tstr); - standard_sub(conn,syscmd); - + if (conn != NULL) + { + standard_sub(conn, syscmd); + } + else + { + standard_sub_basic(syscmd); + } + return (syscmd); } @@ -102,10 +108,9 @@ static char *build_print_command(connection_struct *conn, /**************************************************************************** print a file - called on closing the file ****************************************************************************/ -void print_file(connection_struct *conn, files_struct *file) +void print_file(connection_struct *conn, int snum, files_struct *file) { pstring syscmd; - int snum = SNUM(conn); char *tempstr; *syscmd = 0; @@ -116,7 +121,7 @@ void print_file(connection_struct *conn, files_struct *file) return; } - tempstr = build_print_command(conn, + tempstr = build_print_command(conn, snum, PRINTCOMMAND(snum), syscmd, file->fsp_name); if (tempstr != NULL) { @@ -959,8 +964,7 @@ static BOOL parse_lpq_entry(int snum,char *line, /**************************************************************************** get a printer queue ****************************************************************************/ -int get_printqueue(int snum, - connection_struct *conn,print_queue_struct **queue, +int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue, print_status_struct *status) { char *lpq_command = lp_lpqcommand(snum); @@ -991,7 +995,14 @@ int get_printqueue(int snum, pstrcpy(syscmd,lpq_command); string_sub(syscmd,"%p",printername); - standard_sub(conn,syscmd); + if (conn != NULL) + { + standard_sub(conn, syscmd); + } + else + { + standard_sub_basic(syscmd); + } slprintf(outfile,sizeof(outfile)-1, "%s/lpq.%08x",tmpdir(),str_checksum(syscmd)); @@ -1080,7 +1091,14 @@ void del_printqueue(connection_struct *conn,int snum,int jobid) pstrcpy(syscmd,lprm_command); string_sub(syscmd,"%p",printername); string_sub(syscmd,"%j",jobstr); - standard_sub(conn,syscmd); + if (conn != NULL) + { + standard_sub(conn, syscmd); + } + else + { + standard_sub_basic(syscmd); + } ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); @@ -1118,7 +1136,14 @@ void status_printjob(connection_struct *conn,int snum,int jobid,int status) pstrcpy(syscmd,lpstatus_command); string_sub(syscmd,"%p",printername); string_sub(syscmd,"%j",jobstr); - standard_sub(conn,syscmd); + if (conn != NULL) + { + standard_sub(conn, syscmd); + } + else + { + standard_sub_basic(syscmd); + } ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); @@ -1173,7 +1198,14 @@ void status_printqueue(connection_struct *conn,int snum,int status) pstrcpy(syscmd,queuestatus_command); string_sub(syscmd,"%p",printername); - standard_sub(conn,syscmd); + if (conn != NULL) + { + standard_sub(conn, syscmd); + } + else + { + standard_sub_basic(syscmd); + } ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); |