completes the patch to create and use standard_sub_vuser(). in some
authorLuke Leighton <lkcl@samba.org>
Fri, 4 Feb 2000 17:58:45 +0000 (17:58 +0000)
committerLuke Leighton <lkcl@samba.org>
Fri, 4 Feb 2000 17:58:45 +0000 (17:58 +0000)
instances i have added UID_FIELD_INVALID so that standard_sub_vuser
defaults to the same functionality and standard_sub_basic().

source/include/proto.h
source/passdb/mysqlsampass.c
source/passdb/sampass.c
source/passdb/sampassdb.c
source/smbd/close.c
source/smbd/reply.c
source/spoolssd/srv_spoolss_nt.c

index 38ee4a5f206684325e647a96d18037d5ed445c8b..9eeb1aea86163b1ef50a53a51a45bd3bfbaf9df9 100644 (file)
@@ -516,7 +516,8 @@ struct in_addr *interpret_addr2(char *str);
 BOOL zero_ip(struct in_addr ip);
 BOOL matchname(char *remotehost,struct in_addr  addr);
 void standard_sub_basic(char *str);
-void standard_sub(connection_struct *conn,char *str);
+void standard_sub_vuser(const user_struct *vuser, char *str);
+void standard_sub(connection_struct *conn, user_struct *vuser, char *str);
 BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
 struct hostent *Get_Hostbyname(const char *name);
 BOOL process_exists(int pid);
@@ -1522,10 +1523,6 @@ char *lp_groupname_map(void);
 char *lp_builtinname_map(void);
 char *lp_builtinrid_file(void);
 char *lp_ntusrname_map(void);
-char *lp_logon_script(void);
-char *lp_logon_path(void);
-char *lp_logon_drive(void);
-char *lp_logon_home(void);
 char *lp_remote_announce(void);
 char *lp_remote_browse_sync(void);
 char *lp_wins_server(void);
@@ -1614,6 +1611,10 @@ int lp_change_notify_timeout(void);
 int lp_stat_cache_size(void);
 int lp_map_to_guest(void);
 int lp_ldap_port(void);
+char *lp_logon_script(uint16 );
+char *lp_logon_path(uint16 );
+char *lp_logon_drive(uint16 );
+char *lp_logon_home(uint16 );
 char *lp_preexec(int );
 char *lp_postexec(int );
 char *lp_rootpreexec(int );
@@ -1941,14 +1942,19 @@ int sysv_printername_ok(char *name);
 /*The following definitions come from  printing/printing.c  */
 
 void lpq_reset(int snum);
-void print_file(connection_struct *conn, int snum, files_struct *file);
-int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue,
+void print_file(connection_struct *conn, uint16 vuid,
+                               int snum, files_struct *file);
+int get_printqueue(int snum, connection_struct *conn, uint16 vuid,
+                               print_queue_struct **queue,
                   print_status_struct *status);
-void del_printqueue(connection_struct *conn,int snum,int jobid);
-void status_printjob(connection_struct *conn,int snum,int jobid,int status);
+void del_printqueue(connection_struct *conn,uint16 vuid,
+                               int snum,int jobid);
+void status_printjob(connection_struct *conn,uint16 vuid,
+                               int snum,int jobid,int status);
 int printjob_encode(int snum, int job);
 void printjob_decode(int jobid, int *snum, int *job);
-uint32 status_printqueue(connection_struct *conn,int snum,int status);
+uint32 status_printqueue(connection_struct *conn,uint16 vuid,
+                               int snum,int status);
 void load_printers(void);
 
 /*The following definitions come from  profile/profile.c  */
index c21248af447487c99f927f471a4abbc22bc2c992..1ab791b826594d1262e28eea49bec9f92656bf81 100644 (file)
@@ -29,9 +29,6 @@ MYSQL_ROW *mysql_getpwent(void *vp);
 
 extern int DEBUGLEVEL;
 
-extern pstring samlogon_user;
-extern BOOL sam_logon_in_ssb;
-
 void *mysql_fill_sam_passwd( MYSQL_ROW *row )
 {
        static struct sam_passwd *user;
@@ -54,27 +51,12 @@ void *mysql_fill_sam_passwd( MYSQL_ROW *row )
 
        /* 'Researched' from sampass.c =) */
 
-       pstrcpy(samlogon_user, user->unix_name);
-
-       if (samlogon_user[strlen(samlogon_user)-1] == '$' && 
-           user->group_rid != DOMAIN_GROUP_RID_USERS)
-       {
-               DEBUG(0,("trust account %s should be in DOMAIN_GROUP_RID_USERS\n", samlogon_user));
-       }
-
-       /* XXXX hack to get standard_sub_basic() to use sam logon username */
-       /* possibly a better way would be to do a become_user() call */
-
-       sam_logon_in_ssb = True;
-
-       pstrcpy(logon_script , lp_logon_script       ());
-       pstrcpy(profile_path , lp_logon_path         ());
-       pstrcpy(home_drive   , lp_logon_drive        ());
-       pstrcpy(home_dir     , lp_logon_home         ());
+       pstrcpy(logon_script , lp_logon_script       (UID_FIELD_INVALID));
+       pstrcpy(profile_path , lp_logon_path         (UID_FIELD_INVALID));
+       pstrcpy(home_drive   , lp_logon_drive        (UID_FIELD_INVALID));
+       pstrcpy(home_dir     , lp_logon_home         (UID_FIELD_INVALID));
        pstrcpy(workstations , "");
 
-       sam_logon_in_ssb = False;
-
        user->full_name    = full_name;
        user->home_dir     = home_dir;
        user->dir_drive    = home_drive;
index 7f5eea93ffad5cdff77e3f25fa6b826d1f384928..5dd9d99a2badee3e9d6a76867d2b8f30527118eb 100644 (file)
@@ -23,8 +23,6 @@
 #ifdef USE_SMBPASS_DB
 
 extern int DEBUGLEVEL;
-extern pstring samlogon_user;
-extern BOOL sam_logon_in_ssb;
 
 /***************************************************************
  Start to enumerate the smbpasswd list. Returns a void pointer
@@ -98,30 +96,14 @@ static struct sam_passwd *getsamfile21pwent(void *vp)
         * as putting the nt name in is a bit meaningless.
         */
 
-       pstrcpy(samlogon_user, user->unix_name);
-
-       if (samlogon_user[strlen(samlogon_user)-1] == '$' && 
-           user->group_rid != DOMAIN_GROUP_RID_USERS)
-       {
-               DEBUG(0,("trust account %s should be in DOMAIN_GROUP_RID_USERS\n",
-                         samlogon_user));
-       }
-
-       /* XXXX hack to get standard_sub_basic() to use sam logon username */
-       /* possibly a better way would be to do a become_user() call */
-
-       sam_logon_in_ssb = True;
-
        pstrcpy(full_name    , "");
-       pstrcpy(logon_script , lp_logon_script       ());
-       pstrcpy(profile_path , lp_logon_path         ());
-       pstrcpy(home_drive   , lp_logon_drive        ());
-       pstrcpy(home_dir     , lp_logon_home         ());
+       pstrcpy(logon_script , lp_logon_script       (UID_FIELD_INVALID));
+       pstrcpy(profile_path , lp_logon_path         (UID_FIELD_INVALID));
+       pstrcpy(home_drive   , lp_logon_drive        (UID_FIELD_INVALID));
+       pstrcpy(home_dir     , lp_logon_home         (UID_FIELD_INVALID));
        pstrcpy(acct_desc    , "");
        pstrcpy(workstations , "");
 
-       sam_logon_in_ssb = False;
-
        /* 
           only overwrite values with defaults IIF specific backend
           didn't filled the values
index 72ef8af3e8265f307a573f538ccbad4696be66eb..12f66bf00d3a676ded7963595d447bb05f415a83 100644 (file)
@@ -612,9 +612,6 @@ struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user)
        static pstring acct_desc;
        static pstring workstations;
 
-       extern BOOL sam_logon_in_ssb;
-       extern pstring samlogon_user;
-
        if (user == NULL) return NULL;
 
        pwdb_init_sam(&pw_buf);
@@ -650,21 +647,6 @@ struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user)
 
        DEBUG(5,("getsamfile21pwent\n"));
 
-       /* XXXX hack to get standard_sub_basic() to use sam logon username */
-       /* possibly a better way would be to do a become_user() call */
-
-       sam_logon_in_ssb = True;
-
-       pstrcpy(samlogon_user, pw_buf.unix_name);
-
-       pstrcpy(logon_script , lp_logon_script       ());
-       pstrcpy(profile_path , lp_logon_path         ());
-       pstrcpy(home_drive   , lp_logon_drive        ());
-       pstrcpy(home_dir     , lp_logon_home         ());
-       pstrcpy(workstations , "");
-
-       sam_logon_in_ssb = False;
-
        if (pw_buf.home_dir == NULL)
                pw_buf.home_dir     = home_dir;
        if (pw_buf.dir_drive == NULL)
index e18454bfa7b425f55a995f5513dd24509ca17aed..d81961b7cd65a65e66f93915cc9530cee19ca6c0 100644 (file)
@@ -128,7 +128,7 @@ void close_file(files_struct *fsp, BOOL normal_close)
 
        /* NT uses smbclose to start a print - weird */
        if (normal_close && fsp->print_file)
-               print_file(conn, SNUM(conn), fsp);
+               print_file(conn, fsp->vuid, SNUM(conn), fsp);
 
        /* check for magic scripts */
        if (normal_close) {
index 718f0cf47f8d3e3ca01b9123b8cd3bb3d103fc89..cee776351a602ebca602afbe79ba7934d7da8a3e 100644 (file)
@@ -2763,6 +2763,7 @@ int reply_printqueue(connection_struct *conn,
        int outsize = set_message(outbuf,2,3,True);
        int max_count = SVAL(inbuf,smb_vwv0);
        int start_index = SVAL(inbuf,smb_vwv1);
+       uint16 vuid = SVAL(inbuf,smb_uid);
 
        /* we used to allow the client to get the cnum wrong, but that
           is really quite gross and only worked when there was only
@@ -2782,7 +2783,7 @@ int reply_printqueue(connection_struct *conn,
        {
                print_queue_struct *queue = NULL;
                char *p = smb_buf(outbuf) + 3;
-               int count = get_printqueue(SNUM(conn), conn,&queue,NULL);
+               int count = get_printqueue(SNUM(conn), conn, vuid, &queue,NULL);
                int num_to_get = ABS(max_count);
                int first = (max_count>0?start_index:start_index+max_count+1);
                int i;
index 14d2dc200a2901949e7c85241ed048c1bf12519c..e18417247126ee829a95240f482ed718a282faa2 100755 (executable)
@@ -997,7 +997,7 @@ static void spoolss_notify_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_
 
        bzero(&status,sizeof(status));
 
-       count=get_printqueue(snum, NULL, &q, &status);
+       count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &q, &status);
 
        data->notify_data.value[0]=(uint32) status.status;
        if (q) free(q);
@@ -1013,7 +1013,7 @@ static void spoolss_notify_cjobs(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_q
 
        bzero(&status,sizeof(status));
 
-       data->notify_data.value[0]=get_printqueue(snum, NULL, &q, &status);
+       data->notify_data.value[0]=get_printqueue(snum, NULL, UID_FIELD_INVALID, &q, &status);
        if (q) free(q);
 }
 
@@ -1408,7 +1408,7 @@ static uint32 printer_notify_info(const POLICY_HND *hnd,
                print_queue_struct *queue=NULL;
                print_status_struct status;
                bzero(&status, sizeof(status)); 
-               count=get_printqueue(snum, NULL, &queue, &status);
+               count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &status);
                for (j=0; j<count; j++)
                {
                        construct_notify_jobs_info(&(queue[j]), info, pnum, snum, i, queue[j].job);
@@ -1477,7 +1477,7 @@ static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring s
                return (False);
        }
 
-       count=get_printqueue(snum, NULL, &queue, &status);
+       count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &status);
        
        /* the description and the name are of the form \\server\share */
        slprintf(chaine,sizeof(chaine)-1,"\\\\%s\\%s",servername, ntprinter.info_2->printername);
@@ -1630,7 +1630,7 @@ static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring
        print_queue_struct *queue=NULL;
        print_status_struct status;
        bzero(&status, sizeof(status)); 
-       count=get_printqueue(snum, NULL, &queue, &status);
+       count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &status);
 
        if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0 )
        {
@@ -2377,12 +2377,12 @@ static uint32 control_printer(const POLICY_HND *handle, uint32 command)
        {
                case PRINTER_CONTROL_PAUSE:
                        /* pause the printer here */
-                       return status_printqueue(NULL, snum, LPSTAT_STOPPED);
+                       return status_printqueue(NULL, UID_FIELD_INVALID, snum, LPSTAT_STOPPED);
 
                case PRINTER_CONTROL_RESUME:
                case PRINTER_CONTROL_UNPAUSE:
                        /* UN-pause the printer here */
-                       return status_printqueue(NULL, snum, LPSTAT_OK);
+                       return status_printqueue(NULL, UID_FIELD_INVALID, snum, LPSTAT_OK);
                case PRINTER_CONTROL_PURGE:
                        /* Envoi des dragĂ©es FUCA dans l'imprimante */
                        break;
@@ -2617,7 +2617,7 @@ uint32 _spoolss_enumjobs( const POLICY_HND *handle,
                return NT_STATUS_INVALID_HANDLE;
        }
 
-       count = get_printqueue(snum, NULL, &queue, &prt_status);
+       count = get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &prt_status);
        (*numofjobs) = 0;
        
        DEBUG(4,("count:[%d], status:[%d], [%s]\n",
@@ -2694,7 +2694,7 @@ uint32 _spoolss_setjob( const POLICY_HND *handle,
                return NT_STATUS_INVALID_HANDLE;
        }
 
-       count=get_printqueue(snum, NULL, &queue, &prt_status);          
+       count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &prt_status);               
 
        while ( (i<count) && found==False )
        {
@@ -2712,19 +2712,19 @@ uint32 _spoolss_setjob( const POLICY_HND *handle,
                        case JOB_CONTROL_CANCEL:
                        case JOB_CONTROL_DELETE:
                        {
-                               del_printqueue(NULL, snum, jobid);
+                               del_printqueue(NULL, UID_FIELD_INVALID, snum, jobid);
                                safe_free(queue);
                                return NT_STATUS_NOPROBLEMO;
                        }
                        case JOB_CONTROL_PAUSE:
                        {
-                               status_printjob(NULL, snum, jobid, LPQ_PAUSED);
+                               status_printjob(NULL, UID_FIELD_INVALID, snum, jobid, LPQ_PAUSED);
                                safe_free(queue);
                                return NT_STATUS_NOPROBLEMO;
                        }
                        case JOB_CONTROL_RESUME:
                        {
-                               status_printjob(NULL, snum, jobid, LPQ_QUEUED);
+                               status_printjob(NULL, UID_FIELD_INVALID, snum, jobid, LPQ_QUEUED);
                                safe_free(queue);
                                return NT_STATUS_NOPROBLEMO;
                        }
@@ -3323,7 +3323,7 @@ uint32 _spoolss_getjob( const POLICY_HND *handle,
        {
                return NT_STATUS_INVALID_HANDLE;
        }
-       count=get_printqueue(snum, NULL, &queue, &prt_status);
+       count=get_printqueue(snum, NULL, UID_FIELD_INVALID, &queue, &prt_status);
        
        DEBUGADD(4,("count:[%d], prt_status:[%d], [%s]\n",
                     count, prt_status.status, prt_status.message));