Eliminate valgrind error when client gets bad sig on list. Some reformatting.
authorJeremy Allison <jra@samba.org>
Wed, 30 Jul 2003 18:57:37 +0000 (18:57 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 30 Jul 2003 18:57:37 +0000 (18:57 +0000)
Jeremy.
(This used to be commit b8f6b836468b3a0ae75977dc65cae8400f74734c)

source3/libsmb/clierror.c
source3/libsmb/clilist.c

index 656671823c40ead3257da7af4c55321d69a84a6d..c27e1955e20c74052b2a7eb2f50d803b7386a21f 100644 (file)
@@ -371,6 +371,9 @@ BOOL cli_is_error(struct cli_state *cli)
 {
        uint32 flgs2 = SVAL(cli->inbuf,smb_flg2), rcls = 0;
 
+       if (cli->fd == -1 && cli->smb_rw_error != 0)
+               return True;
+
         if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) {
                 /* Return error is error bits are set */
                 rcls = IVAL(cli->inbuf, smb_rcls);
index 5bd1283ab7b47ff9697ceb0f73eaf6cd81dccbc6..608d740f83b865fd99d40b8e508f015c07045418 100644 (file)
@@ -101,13 +101,20 @@ static int interpret_long_filename(struct cli_state *cli,
                           cheap to calculate, I suppose, as
                           no DST tables will be needed */
                        
-                       finfo->ctime = interpret_long_date(p); p += 8;
-                       finfo->atime = interpret_long_date(p); p += 8;
-                       finfo->mtime = interpret_long_date(p); p += 8; p += 8;
-                       finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0); p += 8;
+                       finfo->ctime = interpret_long_date(p);
+                       p += 8;
+                       finfo->atime = interpret_long_date(p);
+                       p += 8;
+                       finfo->mtime = interpret_long_date(p);
+                       p += 8;
+                       p += 8;
+                       finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0);
+                       p += 8;
                        p += 8; /* alloc size */
-                       finfo->mode = CVAL(p,0); p += 4;
-                       namelen = IVAL(p,0); p += 4;
+                       finfo->mode = CVAL(p,0);
+                       p += 4;
+                       namelen = IVAL(p,0);
+                       p += 4;
                        p += 4; /* EA size */
                        slen = SVAL(p, 0);
                        p += 2; 
@@ -214,7 +221,8 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
                        uint8 eclass;
                        uint32 ecode;
                        cli_dos_error(cli, &eclass, &ecode);
-                       if (eclass != ERRSRV || ecode != ERRerror) break;
+                       if (eclass != ERRSRV || ecode != ERRerror)
+                               break;
                        msleep(100);
                        continue;
                }
@@ -222,7 +230,8 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
                 if (cli_is_error(cli) || !rdata || !rparam) 
                        break;
 
-               if (total_received == -1) total_received = 0;
+               if (total_received == -1)
+                       total_received = 0;
 
                /* parse out some important return info */
                p = rparam;
@@ -245,8 +254,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
 
                /* we might need the lastname for continuations */
                if (ff_lastname > 0) {
-                       switch(info_level)
-                               {
+                       switch(info_level) {
                                case 260:
                                        clistr_pull(cli, mask, p+ff_lastname,
                                                    sizeof(mask), 
@@ -270,8 +278,9 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
                if (!tdl) {
                        DEBUG(0,("cli_list_new: Failed to expand dirlist\n"));
                        break;
+               } else {
+                       dirlist = tdl;
                }
-               else dirlist = tdl;
 
                /* put in a length for the last entry, to ensure we can chain entries 
                   into the next packet */
@@ -291,7 +300,8 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
                DEBUG(3,("received %d entries (eos=%d)\n",
                         ff_searchcount,ff_eos));
 
-               if (ff_searchcount > 0) loop_count = 0;
+               if (ff_searchcount > 0)
+                       loop_count = 0;
 
                First = False;
        }