challange -> challenge
[samba.git] / source3 / smbd / process.c
index cf691ce9f3539b2517094474436ef8ce9be748b2..d4881b0ba5615ecc4ac4ca73662575367b24b81e 100644 (file)
@@ -120,7 +120,7 @@ static void async_processing(fd_set *fds, char *buffer, int buffer_len)
 
        /* check for sighup processing */
        if (reload_after_sighup) {
-               unbecome_user();
+               change_to_root_user();
                DEBUG(1,("Reloading services after SIGHUP\n"));
                reload_services(False);
                reload_after_sighup = False;
@@ -254,7 +254,7 @@ BOOL receive_next_smb(char *inbuf, int bufsize, int timeout)
        do {
                ret = receive_message_or_smb(inbuf,bufsize,timeout);
                
-               got_keepalive = (ret && (CVAL(inbuf,0) == 0x85));
+               got_keepalive = (ret && (CVAL(inbuf,0) == SMBkeepalive));
        } while (ret && got_keepalive);
 
        return ret;
@@ -361,11 +361,11 @@ struct smb_message_struct
 /* 0x19 */ { NULL, NULL, 0 },
 /* 0x1a */ { "SMBreadbraw",reply_readbraw,AS_USER},
 /* 0x1b */ { "SMBreadBmpx",reply_readbmpx,AS_USER},
-/* 0x1c */ { "SMBreadBs",NULL,AS_USER},
+/* 0x1c */ { "SMBreadBs",NULL,},
 /* 0x1d */ { "SMBwritebraw",reply_writebraw,AS_USER},
-/* 0x1e */ { NULL,NULL,0},
-/* 0x1f */ { NULL,NULL,0},
-/* 0x20 */ { NULL,NULL,0},
+/* 0x1e */ { "SMBwriteBmpx",reply_writebmpx,AS_USER},
+/* 0x1f */ { "SMBwriteBs",reply_writebs,AS_USER},
+/* 0x20 */ { "SMBwritec",NULL,0},
 /* 0x21 */ { NULL, NULL, 0 },
 /* 0x22 */ { "SMBsetattrE",reply_setattrE,AS_USER | NEED_WRITE },
 /* 0x23 */ { "SMBgetattrE",reply_getattrE,AS_USER },
@@ -702,7 +702,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
 
     /* does this protocol need to be run as root? */
     if (!(flags & AS_USER))
-      unbecome_user();
+      change_to_root_user();
 
     /* does this protocol need a valid tree connection? */
     if ((flags & AS_USER) && !conn) {
@@ -711,7 +711,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
 
 
     /* does this protocol need to be run as the connected user? */
-    if ((flags & AS_USER) && !become_user(conn,session_tag)) {
+    if ((flags & AS_USER) && !change_to_user(conn,session_tag)) {
       if (flags & AS_GUEST) 
         flags &= ~AS_USER;
       else
@@ -734,13 +734,13 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
     }
 
     /* load service specific parameters */
-    if (conn && !become_service(conn,(flags & AS_USER)?True:False)) {
+    if (conn && !set_current_service(conn,(flags & AS_USER)?True:False)) {
       return(ERROR_DOS(ERRSRV,ERRaccess));
     }
 
     /* does this protocol need to be run as guest? */
     if ((flags & AS_GUEST) && 
-                (!become_guest() || 
+                (!change_to_guest() || 
                !check_access(smbd_server_fd(), lp_hostsallow(-1), lp_hostsdeny(-1)))) {
       return(ERROR_DOS(ERRSRV,ERRaccess));
     }
@@ -867,7 +867,7 @@ void process_smb(char *inbuf, char *outbuf)
 
   if (msg_type == 0)
     show_msg(inbuf);
-  else if(msg_type == 0x85)
+  else if(msg_type == SMBkeepalive)
     return; /* Keepalive packet. */
 
   nread = construct_reply(inbuf,outbuf,nread,max_send);
@@ -884,7 +884,7 @@ void process_smb(char *inbuf, char *outbuf)
     }
     else
       if (!send_smb(smbd_server_fd(),outbuf))
-        exit_server("process_smb: send_smb failed.\n");
+        exit_server("process_smb: send_smb failed.");
   }
   trans_num++;
 }
@@ -1096,7 +1096,7 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
     last_idle_closed_check = t;
 
   /* become root again if waiting */
-  unbecome_user();
+  change_to_root_user();
 
   /* check if we need to reload services */
   check_reload(t);
@@ -1112,19 +1112,23 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
 
   if (keepalive && (t - last_keepalive_sent_time)>keepalive) 
   {
-    struct cli_state *cli = server_client();
-    if (!send_keepalive(smbd_server_fd())) {
-      DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
-      return False;
-    }      
-    /* also send a keepalive to the password server if its still
-       connected */
-    if (cli && cli->initialised)
-      if (!send_keepalive(cli->fd)) {
-        DEBUG( 2, ( "password server keepalive failed.\n"));
-        cli_shutdown(cli);
-      }
-    last_keepalive_sent_time = t;
+         extern auth_authsupplied_info *negprot_global_auth_info;
+         if (!send_keepalive(smbd_server_fd())) {
+                 DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
+                 return False;
+         }
+         
+         /* send a keepalive for a password server or the like.
+            This is attached to the auth_info created in the
+            negprot */
+         if (negprot_global_auth_info 
+             && negprot_global_auth_info->challenge_set_method 
+             && negprot_global_auth_info->challenge_set_method->send_keepalive) {
+                 negprot_global_auth_info->challenge_set_method->send_keepalive
+                         (&negprot_global_auth_info->challenge_set_method->private_data);
+         }
+
+         last_keepalive_sent_time = t;
   }
 
   /* check for connection timeouts */