smbd/auth_server: Doco, we want to use cli_nt_error here soon
authorAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2001 07:03:27 +0000 (07:03 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2001 07:03:27 +0000 (07:03 +0000)
smbd/password.c: We don't use globals here anymore

smbd/reply.c: Tidyness, global_myworkgroup must die!

smbd/service.c:  Move some of the make_connection code into a helper
                 function.
(This used to be commit 15c87e404fcaff9e360a40b8b673938c6e611daf)

source3/auth/auth_server.c
source3/smbd/auth_server.c
source3/smbd/password.c
source3/smbd/reply.c
source3/smbd/service.c

index dc1d924b3cbe9a1b2bc96563e5225aea1c00b363..1960fc1cfbee28c95f8fbdfe5e601039c44e7d23 100644 (file)
@@ -211,6 +211,7 @@ use this machine as the password server.\n"));
                               user_info->nt_resp.len, 
                               user_info->domain.str)) {
                DEBUG(1,("password server %s rejected the password\n", cli->desthost));
+               /* Make this cli_nt_error() when the conversion is in */
                nt_status = NT_STATUS_LOGON_FAILURE;
        } else {
                nt_status = NT_STATUS_NOPROBLEMO;
index dc1d924b3cbe9a1b2bc96563e5225aea1c00b363..1960fc1cfbee28c95f8fbdfe5e601039c44e7d23 100644 (file)
@@ -211,6 +211,7 @@ use this machine as the password server.\n"));
                               user_info->nt_resp.len, 
                               user_info->domain.str)) {
                DEBUG(1,("password server %s rejected the password\n", cli->desthost));
+               /* Make this cli_nt_error() when the conversion is in */
                nt_status = NT_STATUS_LOGON_FAILURE;
        } else {
                nt_status = NT_STATUS_NOPROBLEMO;
index bbdd0c3bf5ea747a21e662f81fbece6a60e2841c..51df7a95a20c1376ed1dcd26966cebe25deb14bd 100644 (file)
@@ -28,9 +28,6 @@ extern struct in_addr ipzero;
 /* users from session setup */
 static pstring session_users="";
 
-extern pstring global_myname;
-extern fstring global_myworkgroup;
-
 /* this holds info on user ids that are already validated for this VC */
 static user_struct *validated_users;
 static int next_vuid = VUID_OFFSET;
index 47a363ae8d112ba1c13fac6184cfd0f4c5753f7f..ee7185468761c1d50798df0824e29ca399117537 100644 (file)
@@ -37,7 +37,6 @@ extern BOOL case_preserve;
 extern BOOL short_case_preserve;
 extern userdom_struct current_user_info;
 extern pstring global_myname;
-extern fstring global_myworkgroup;
 extern int global_oplock_break;
 uint32 global_client_caps = 0;
 unsigned int smb_echo_count = 0;
@@ -800,7 +799,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
   if (!guest) {
          valid_password = (pass_check_smb(user, domain, 
                                           smb_apasswd, smb_apasslen, 
-                                      smb_ntpasswd, smb_ntpasslen) == NT_STATUS_NOPROBLEMO);
+                                          smb_ntpasswd, smb_ntpasslen) == NT_STATUS_NOPROBLEMO);
 
     /* The true branch will be executed if 
        (1) the NT password failed (or was not tried), and 
@@ -862,7 +861,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
     p = smb_buf(outbuf);
     p += srvstr_push(outbuf, p, "Unix", -1, STR_TERMINATE);
     p += srvstr_push(outbuf, p, "Samba", -1, STR_TERMINATE);
-    p += srvstr_push(outbuf, p, global_myworkgroup, -1, STR_TERMINATE);
+    p += srvstr_push(outbuf, p, lp_workgroup(), -1, STR_TERMINATE);
     set_message_end(outbuf,p);
     /* perhaps grab OS version here?? */
   }
index 13a6a387aeb59fb97caae221680ecffa77d3d5f9..fe0f95ba6ac4b2167a8013587c9a3a8ba2bd3542 100644 (file)
@@ -213,6 +213,47 @@ int find_service(char *service)
 }
 
 
+/****************************************************************************
+ do some basic sainity checks on the share.  
+ This function modifies dev, ecode.
+****************************************************************************/
+static BOOL share_sanity_checks(int snum, char* service, char *dev, int *ecode) 
+{
+       
+       if (!lp_snum_ok(snum) || 
+           !check_access(smbd_server_fd(), 
+                         lp_hostsallow(snum), lp_hostsdeny(snum))) {    
+               *ecode = ERRaccess;
+               return False;
+       }
+
+       /* you can only connect to the IPC$ service as an ipc device */
+       if (strequal(service,"IPC$") || strequal(service,"ADMIN$"))
+               pstrcpy(dev,"IPC");
+       
+       if (*dev == '?' || !*dev) {
+               if (lp_print_ok(snum)) {
+                       pstrcpy(dev,"LPT1:");
+               } else {
+                       pstrcpy(dev,"A:");
+               }
+       }
+
+       /* if the request is as a printer and you can't print then refuse */
+       strupper(dev);
+       if (!lp_print_ok(snum) && (strncmp(dev,"LPT",3) == 0)) {
+               DEBUG(1,("Attempt to connect to non-printer as a printer\n"));
+               *ecode = ERRinvdevice;
+               return False;
+       }
+
+       /* Behave as a printer if we are supposed to */
+       if (lp_print_ok(snum) && (strcmp(dev, "A:") == 0)) {
+               pstrcpy(dev, "LPT1:");
+       }
+       return True;
+}
+
 /****************************************************************************
   make a connection to a service
 ****************************************************************************/
@@ -268,37 +309,9 @@ connection_struct *make_connection(char *service,char *user,char *password, int
                }
        }
 
-       if (!lp_snum_ok(snum) || 
-           !check_access(smbd_server_fd(), 
-                         lp_hostsallow(snum), lp_hostsdeny(snum))) {    
-               *ecode = ERRaccess;
-               return NULL;
-       }
-
-       /* you can only connect to the IPC$ service as an ipc device */
-       if (strequal(service,"IPC$") || strequal(service,"ADMIN$"))
-               pstrcpy(dev,"IPC");
-       
-       if (*dev == '?' || !*dev) {
-               if (lp_print_ok(snum)) {
-                       pstrcpy(dev,"LPT1:");
-               } else {
-                       pstrcpy(dev,"A:");
-               }
-       }
-
-       /* if the request is as a printer and you can't print then refuse */
-       strupper(dev);
-       if (!lp_print_ok(snum) && (strncmp(dev,"LPT",3) == 0)) {
-               DEBUG(1,("Attempt to connect to non-printer as a printer\n"));
-               *ecode = ERRinvdevice;
+       if (!share_sanity_checks(snum, service, dev, ecode)) {
                return NULL;
-       }
-
-       /* Behave as a printer if we are supposed to */
-       if (lp_print_ok(snum) && (strcmp(dev, "A:") == 0)) {
-               pstrcpy(dev, "LPT1:");
-       }
+       }       
 
        /* lowercase the user name */
        strlower(user);