debugging the srvsvc Net Share Enum. some padding issues; some string length
authorLuke Leighton <lkcl@samba.org>
Sun, 19 Oct 1997 17:54:13 +0000 (17:54 +0000)
committerLuke Leighton <lkcl@samba.org>
Sun, 19 Oct 1997 17:54:13 +0000 (17:54 +0000)
issues.  it works!
(This used to be commit 80523a3e83191c9e0b930fc71bd502a94a6f1b19)

source3/include/smb.h
source3/pipesrvsvc.c
source3/srvparse.c

index 7fa19eaa19a92e641a5bcedc75be31112f803114..0d10bd58954d58f3825e97f8b71db9bdda59a90d 100644 (file)
@@ -865,9 +865,11 @@ typedef struct share_info_ctr
 {
        uint32 num_entries_read;                     /* EntriesRead */
        uint32 ptr_share_info;                       /* Buffer */
+       uint32 num_entries_read2;                    /* EntriesRead */
        SH_INFO_1     info_1    [MAX_SHARE_ENTRIES]; /* share entry pointers */
        SH_INFO_1_STR info_1_str[MAX_SHARE_ENTRIES]; /* share entry strings */
-       uint32 num_entries_read2;                    /* EntriesRead2 */
+       uint32 num_entries_read3;                    /* EntriesRead2 */
+       uint32 padding;                              /* padding */
 
 } SHARE_INFO_1_CTR;
 
index 10c8d97e7575830cdab9b3256711c040b2c29892..28a304ef4a19e5efae73375f413d734cba161d75 100644 (file)
@@ -37,8 +37,8 @@ static void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *r
 
        DEBUG(5,("make_srv_share_info1_str: %s %s\n", net_name, remark));
 
-       make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name));
-       make_unistr2(&(sh1->uni_remark ), remark  , strlen(remark  ));
+       make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1);
+       make_unistr2(&(sh1->uni_remark ), remark  , strlen(remark  )+1);
 }
 
 /*******************************************************************
@@ -103,8 +103,10 @@ static void make_srv_share_1_ctr(SHARE_INFO_1_CTR *ctr)
        }
 
        ctr->num_entries_read  = num_entries;
-       ctr->ptr_share_info = num_entries > 0 ? 1 : 0;
+       ctr->ptr_share_info    = num_entries > 0 ? 1 : 0;
        ctr->num_entries_read2 = num_entries;
+       ctr->num_entries_read3 = num_entries;
+       ctr->padding           = 0;
 }
 
 /*******************************************************************
index a94efff1384dc441e0a6b763c321345e83cf65cd..8138285caf09f4065a92f64a5f38b4a7ef534467 100644 (file)
@@ -85,6 +85,8 @@ char* srv_io_share_1_ctr(BOOL io, SHARE_INFO_1_CTR *ctr, char *q, char *base, in
                        num_entries = MAX_SHARE_ENTRIES; /* report this! */
                }
 
+               DBG_RW_IVAL("num_entries_read2", depth, base, io, q, ctr->num_entries_read2); q += 4;
+
                for (i = 0; i < num_entries; i++)
                {
                        q = srv_io_share_info1(io, &(ctr->info_1[i]), q, base, align, depth); 
@@ -95,7 +97,9 @@ char* srv_io_share_1_ctr(BOOL io, SHARE_INFO_1_CTR *ctr, char *q, char *base, in
                        q = srv_io_share_info1_str(io, &(ctr->info_1_str[i]), q, base, align, depth); 
                }
 
-               DBG_RW_IVAL("num_entries_read2", depth, base, io, q, ctr->num_entries_read); q += 4;
+               q = align_offset(q, base, align);
+               DBG_RW_IVAL("num_entries_read3", depth, base, io, q, ctr->num_entries_read3); q += 4;
+               DBG_RW_IVAL("padding          ", depth, base, io, q, ctr->padding); q += 4;
        }
 
        return q;