nggh! damn select timeout, FD_ISSET... THING.
authorLuke Leighton <lkcl@samba.org>
Tue, 11 Apr 2000 06:42:25 +0000 (06:42 +0000)
committerLuke Leighton <lkcl@samba.org>
Tue, 11 Apr 2000 06:42:25 +0000 (06:42 +0000)
source/include/proto.h
source/include/rpc_creds.h
source/lib/util_sock.c
source/msrpc/msrpcd_process.c
source/rpc_parse/parse_creds.c

index aeb2eaae73bb799a38db575129c426d3ea315cf2..b955571b5ccce0169226595225d3e7356e6af71f 100644 (file)
@@ -768,7 +768,7 @@ BOOL is_a_socket(int fd);
 void set_socket_options(int fd, char *options);
 void close_sockets(void);
 ssize_t write_socket(int fd, char *buf, size_t len);
-int write_data_outstanding(int fd, unsigned int time_out);
+int write_data_outstanding(int fd, unsigned int time_out, BOOL *more);
 int read_data_outstanding(int fd, unsigned int time_out);
 ssize_t read_udp_socket(int fd, char *buf, size_t len);
 ssize_t read_with_timeout(int fd, char *buf, size_t mincnt, size_t maxcnt,
index 2b897da67919f1f2daffcfa55a97d45f6013cb7f..f846a8b58edf42b42ac9ce1e315d35fc4af90214 100644 (file)
@@ -53,7 +53,7 @@ typedef struct unixsec_creds
 
 typedef struct user_creds
 {
-       BOOL reuse;
+       uint32 reuse;
 
        uint32 ptr_ntc;
        uint32 ptr_uxc;
index 459ab16501d9791baa980ecaddba5f8390c29ee6..f751cea7ec80373d80312d5d8c7cb227223c826b 100644 (file)
@@ -238,7 +238,7 @@ ssize_t write_socket(int fd, char *buf, size_t len)
 /*******************************************************************
  checks if write data is outstanding.
  ********************************************************************/
-int write_data_outstanding(int fd, unsigned int time_out)
+int write_data_outstanding(int fd, unsigned int time_out, BOOL *more)
 {
        int selrtn;
        fd_set fds;
@@ -256,7 +256,8 @@ int write_data_outstanding(int fd, unsigned int time_out)
        {
                return selrtn;
        }
-       return FD_ISSET(fd, &fds) ? 1 : 0;
+       (*more) = FD_ISSET(fd, &fds);
+       return selrtn;
 }
 
 /*******************************************************************
index 870ce2621a414f56e46b371581cdffbb8469106f..92e32cc21696d8f3cd6c47dc1991a5a396e1e3ab 100644 (file)
@@ -140,10 +140,11 @@ static void process_msrpc(rpcsrv_struct * l, const char *name,
                {
                        int selrtn;
                        int timeout = SMBD_SELECT_TIMEOUT * 1000;
+                       BOOL more;
 
                        smb_read_error = 0;
 
-                       selrtn = write_data_outstanding(l->c, timeout);
+                       selrtn = write_data_outstanding(l->c, timeout, &more);
 
                        /* Check if error */
                        if (selrtn == -1)
@@ -159,9 +160,13 @@ static void process_msrpc(rpcsrv_struct * l, const char *name,
                                return;
                        }
 
-                       if (!msrpc_send(l->c, &l->rsmb_pdu))
+                       if (more)
                        {
-                               DEBUG(1,("msrpc_send: failed\n"));
+                               if (!msrpc_send(l->c, &l->rsmb_pdu))
+                               {
+                                       prs_free_data(&l->rsmb_pdu);
+                               }
+                               break;
                        }
                        prs_free_data(&l->rsmb_pdu);
                }
index 29a5bb12f0aa25c3ac7cba93ed0d0cc402509a08..c8c9a4e61ed23a2fb182da00a1207891bf70e670 100644 (file)
@@ -287,7 +287,7 @@ void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from)
                return;
        }
        fstrcpy(to->user_name, from->user_name);
-};
+}
 
 void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from)
 {
@@ -315,7 +315,7 @@ void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from)
                to->num_grps = from->num_grps;
                memcpy(to->grps, from->grps, size);
        }
-};
+}
 
 void copy_nt_creds(struct ntuser_creds *to,
                                const struct ntuser_creds *from)
@@ -337,7 +337,7 @@ void copy_nt_creds(struct ntuser_creds *to,
        DEBUG(10,("copy_nt_creds: user %s domain %s nopw %s flgs: %x\n",
               to->user_name, to->domain, BOOLSTR(pwd_is_nullpwd(&to->pwd)),
               to->ntlmssp_flags));
-};
+}
 
 void copy_user_creds(struct user_creds *to,
                                const struct user_creds *from)
@@ -386,7 +386,7 @@ void copy_user_creds(struct user_creds *to,
        {
                copy_unix_sec_creds(&to->uxs, &from->uxs);
        }
-};
+}
 
 void free_user_creds(struct user_creds *creds)
 {