It compiles for me now :-). rpc_server/srv_lsa.c - added fix to allow w2k
authorJeremy Allison <jra@samba.org>
Tue, 13 Feb 2001 16:28:48 +0000 (16:28 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 13 Feb 2001 16:28:48 +0000 (16:28 +0000)
clients to join a Samba domain - odd or even domain name length. Needs more testing.
Jeremy.

source/lib/debug.c
source/rpc_server/srv_lsa.c
source/tdb/tdbtool.c

index e7772bbd38caaddaac092237be95738e257c3d3a..119292b7813ea7c5e62ffc0f643d5f66ca1f7765 100644 (file)
@@ -135,9 +135,9 @@ char *classname_table[] = {
 /****************************************************************************
 utility access to debug class names's
 ****************************************************************************/
-char* debug_classname_from_index(int idx)
+char* debug_classname_from_index(int ndx)
 {
-       return classname_table[idx];
+       return classname_table[ndx];
 }
 
 /****************************************************************************
@@ -162,7 +162,7 @@ parse the debug levels from smbcontrol. Example debug level parameter:
 ****************************************************************************/
 BOOL debug_parse_params(char **params, int *debuglevel_class)
 {
-       int   i, idx;
+       int   i, ndx;
        char *class_name;
        char *class_level;
        
@@ -183,8 +183,8 @@ BOOL debug_parse_params(char **params, int *debuglevel_class)
        for (; i < DBGC_LAST && params[i]; i++) {
                if ((class_name=strtok(params[i],":")) &&
                        (class_level=strtok(NULL, "\0")) &&
-            ((idx = debug_lookup_classname(class_name)) != -1)) {
-                               debuglevel_class[idx] = atoi(class_level);
+            ((ndx = debug_lookup_classname(class_name)) != -1)) {
+                               debuglevel_class[ndx] = atoi(class_level);
                } else {
                        DEBUG(0,("debug_parse_params: unrecognized debug class name or format [%s]\n", params[i]));
                        return False;
@@ -208,7 +208,7 @@ BOOL debug_parse_levels(char *params_str)
        ZERO_ARRAY(params);
        ZERO_ARRAY(debuglevel_class);
 
-       if ( (params[0]=strtok(params_str," ,")) ) {
+       if ((params[0]=strtok(params_str," ,"))) {
                for (i=1; i<DBGC_LAST;i++) {
                        if ((params[i]=strtok(NULL," ,"))==NULL)
                                break;
index b9b7a0328d7f869fb8fded8a7b2f6249c5078f81..3629bb7d8e3f9dc79de6a39a60b04469341bf210 100644 (file)
@@ -90,14 +90,23 @@ static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid)
 {
        int domlen = (dom_name != NULL) ? strlen(dom_name) : 0;
 
+       /*
+        * I'm not sure why this really odd combination of length
+        * values works, but it does appear to. I need to look at
+        * this *much* more closely - but at the moment leave alone
+        * until it's understood. This allows a W2k client to join
+        * a domain with both odd and even length names... JRA.
+        */
+
+       d_q->uni_dom_str_len = domlen ? ((domlen + 1) * 2) : 0;
        d_q->uni_dom_max_len = domlen * 2;
-       d_q->uni_dom_str_len = domlen * 2;
-
-       d_q->buffer_dom_name = dom_name ? 1 : 0;
-       d_q->buffer_dom_sid  = dom_sid ? 1 : 0;
+       d_q->buffer_dom_name = domlen != 0 ? 1 : 0; /* domain buffer pointer */
+       d_q->buffer_dom_sid = dom_sid != NULL ? 1 : 0;  /* domain sid pointer */
 
        /* this string is supposed to be character short */
        init_unistr2(&d_q->uni_domain_name, dom_name, domlen);
+       d_q->uni_domain_name.uni_max_len++;
+
        if (dom_sid != NULL)
                init_dom_sid2(&d_q->dom_sid, dom_sid);
 }
index 1b038226d0243f1b2ac9803e4c42623027776f1a..27454f73dea0512e33e5fb1268efe81b27a910e3 100644 (file)
@@ -89,8 +89,10 @@ tdbtool:
   show      key        : show a record by key
   delete    key        : delete a record by key
   free                 : print the database freelist
-  first                : print the first record
-  next                 : print the next record
+  1 | first            : print the first record
+  n | next             : print the next record
+  q | quit             : terminate
+  \\n                   : repeat 'next' command
 ");
 }
 
@@ -250,8 +252,10 @@ static void info_tdb(void)
 {
        int count;
        total_bytes = 0;
-       count = tdb_traverse(tdb, traverse_fn, NULL);
-       printf("%d records totalling %d bytes\n", count, total_bytes);
+       if ((count = tdb_traverse(tdb, traverse_fn, NULL) == -1))
+               printf("Error = %s\n", tdb_errorstr(tdb));
+       else
+               printf("%d records totalling %d bytes\n", count, total_bytes);
 }
 
 static char *getline(char *prompt)
@@ -363,11 +367,16 @@ int main(int argc, char *argv[])
             info_tdb();
         } else if (strcmp(tok, "free") == 0) {
             tdb_printfreelist(tdb);
-        } else if (strcmp(tok, "first") == 0) {
+        } else if ( (strcmp(tok, "1") == 0) ||
+                    (strcmp(tok, "first") == 0)) {
             bIterate = 1;
             first_record(tdb, &iterate_kbuf);
-        } else if (strcmp(tok, "next") == 0) {
+        } else if ((strcmp(tok, "n") == 0) ||
+                   (strcmp(tok, "next") == 0)) {
             next_record(tdb, &iterate_kbuf);
+        } else if ((strcmp(tok, "q") == 0) ||
+                   (strcmp(tok, "quit") == 0)) {
+            break;
         } else {
             help();
         }