[Fedora-directory-commits] adminserver/admserv/cgi-src40 Makefile, 1.10, 1.11 admpw.c, 1.6, 1.7

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Tue Oct 10 19:56:32 UTC 2006


Author: rmeggins

Update of /cvs/dirsec/adminserver/admserv/cgi-src40
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16418/adminserver/admserv/cgi-src40

Modified Files:
	Makefile admpw.c 
Log Message:
Bug(s) fixed: 210180
Bug Description: Fix FDS103 Admin Server build issues
Reviewed by: nkinder, nhosoi (Thanks!)
Fix Description: Some of these are related to moving to mozldap6.  The others are related to code that was checked in for 1.1, to remove unused files.
Platforms tested: RHEL3
Flag Day: no
Doc impact: no



Index: Makefile
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Makefile	11 May 2006 14:29:30 -0000	1.10
+++ Makefile	10 Oct 2006 19:56:29 -0000	1.11
@@ -248,7 +248,6 @@
 endif
 
 ifeq ($(ARCH), Linux)
-LDAPLINK += -llber50
 ARCH_CFLAGS += -fpermissive
 endif
 


Index: admpw.c
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/admpw.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- admpw.c	15 Jun 2006 17:04:58 -0000	1.6
+++ admpw.c	10 Oct 2006 19:56:29 -0000	1.7
@@ -41,6 +41,11 @@
 #include <stdlib.h>
 #include <string.h>
 
+/* NSS - for password hashing */
+#include <pk11func.h>
+#include <pk11pqg.h>
+#include <base64.h>
+
 #include "libadminutil/resource.h"
 #include "libadminutil/admutil.h"
 #include "libadminutil/distadm.h"
@@ -53,6 +58,34 @@
 static void update_adm_conf(char *newpw);
 static void update_ds(char *newpw);
 
+#define SHA1_LENGTH     20
+
+static char *
+sha1_pw_enc(const char *pwd)
+{
+   unsigned char hash[SHA1_LENGTH];
+   char *enc;
+   char *retval;
+   SECStatus rc;
+
+   /* SHA1 hash the user's key */
+   rc = PK11_HashBuf(SEC_OID_SHA1, hash, (unsigned char *)pwd, strlen(pwd));
+   /* convert to base64 */
+   if (!(enc = BTOA_DataToAscii(hash, sizeof(hash)))) {
+      return NULL;
+   }
+   /* add "{SHA}" in front of string */
+   if ((retval = (char *) malloc(strlen(enc) + 5)) == NULL)
+   {
+      PORT_Free(enc);
+      return (NULL);
+   }
+   sprintf(retval, "{SHA}%s", enc);
+   PORT_Free(enc);
+
+   return retval;
+}
+
 /*
  * Logging function
  */
@@ -282,7 +315,7 @@
 	if (newpw != NULL) {
 		update_ds(newpw);
 		update_adm_conf(newpw);
-		update_admpwd(newuid, admin40_pw_enc(newpw));
+		update_admpwd(newuid, sha1_pw_enc(newpw));
 	}
 	else {
 		update_admpwd(newuid, pw);




More information about the 389-commits mailing list