[Fedora-directory-commits] adminutil/tests retrieveSIEssl.c, 1.2, 1.3

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Fri Jun 22 21:06:47 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/adminutil/tests
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11511/adminutil/tests

Modified Files:
	retrieveSIEssl.c 
Log Message:
Resolves: bug 245396
Bug Description: adminutil: retrieveISIEs returns bogus data
Reviewed by: nkinder (Thanks!)
Fix Description: retrieveISIEs creates a list of id + DN pairs using
the ListNodePtr interface.  Each node has a name (the id) and a value
(a char ** with the DN as the first char *) and forms a linked list of
all of the values.  It then flattens the list into an array of name/value
pairs for returning.  However, instead of passing val[0] to the
addSingleValueAttribute() function for the value, it was passing val cast
to a (char *), which is entirely bogus.
The fix is to pass in ((char**)node->val)[0] which is a char * value.  Yet
another lesson in why void * is bad, and why you should not defeat the
compiler's type checker . . .
I also fixed another minor mem leak, and added @nss_inc@ to the list of include directories - I guess it works because pkg-config mozldap[6] always returns the
nss include directory in its output . . .
Platforms tested: RHEL4
Flag day: Yes - autotool file changes



Index: retrieveSIEssl.c
===================================================================
RCS file: /cvs/dirsec/adminutil/tests/retrieveSIEssl.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- retrieveSIEssl.c	8 May 2007 19:13:26 -0000	1.2
+++ retrieveSIEssl.c	22 Jun 2007 21:06:45 -0000	1.3
@@ -48,6 +48,8 @@
     char *siedn = NULL;
     char *siepwd = NULL;
     char buf[BUFSIZ];
+    char *userdn;
+    char *passwd;
 
     if (ac > 1) {
         configdir = strdup(*(av+1));
@@ -87,6 +89,12 @@
         goto done;
     }
 
+    siedn = admldapGetSIEDN(ldapInfo);
+    ADM_GetUserDNString(&rval, &userdn);
+    ADM_GetCurrentPassword(&rval, &passwd);
+
+    admldapSetSIEDN(ldapInfo, userdn);
+    admSetCachedSIEPWD(passwd);
     /*
      * get servers' DNs belonging to the Admin Server
      */
@@ -97,9 +105,9 @@
         goto done;
     }
 
+    admldapSetSIEDN(ldapInfo, siedn);
+
     host = admldapGetHost(ldapInfo);
-    siedn = admldapGetSIEDN(ldapInfo);
-    siepwd = admldapGetSIEPWD(ldapInfo);
     for (p = nameList; p && *p; p++) {
         PsetHndl pset = NULL;
         fprintf(stdout, "%s\n", *p);
@@ -112,8 +120,8 @@
                                  admldapGetPort(ldapInfo),
                                  admldapGetSecurity(ldapInfo),
                                  *p,
-                                 siedn,
-                                 siepwd,
+                                 userdn,
+                                 passwd,
                                  NULL,
                                  &rval);
         if (rval && (rval != PSET_LOCAL_OPEN_FAIL)) {
@@ -145,13 +153,13 @@
         fprintf(stdout, "FAILURE: SIE is not retrieved\n");
     }
     PL_strfree(host);
-    PL_strfree(siedn);
-    PL_strfree(siepwd);
 
     /*
      * get servers' DNs belonging to the Admin Server
      */
+    admldapSetSIEDN(ldapInfo, userdn);
     isieList = getInstalledServerDNListSSL(ldapInfo);
+    admldapSetSIEDN(ldapInfo, siedn);
     if (NULL == isieList) {
         fprintf(stderr, "ERROR: empty isieList\n");
         rval = 1;
@@ -159,7 +167,8 @@
     }
 
     for (siecnt = 0; isieList[siecnt]; siecnt++) {
-        fprintf(stdout, "%s\n", isieList[siecnt]->attrName);
+        fprintf(stdout, "productID = %s\n", isieList[siecnt]->attrName);
+        fprintf(stdout, "productDN = %s\n", isieList[siecnt]->attrVal[0]);
     }
     deleteAttributeList(isieList);
     if (siecnt > 0) {




More information about the Fedora-directory-commits mailing list