[Fedora-directory-commits] ldapserver/ldap/synctools/passwordsync passhand.cpp, 1.7, 1.7.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/synctools/passwordsync
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12158/ldap/synctools/passwordsync
Modified Files:
Tag: Directory71RtmBranch
passhand.cpp
Log Message:
186765 - Fixed memory leaks in passsync service
Index: passhand.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/synctools/passwordsync/passhand.cpp,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- passhand.cpp 19 Apr 2005 22:07:43 -0000 1.7
+++ passhand.cpp 18 Mar 2006 00:31:54 -0000 1.7.2.1
@@ -62,7 +62,7 @@
fstream outFile;
PASS_INFO_LIST_ITERATOR currentPair;
strstream plainTextStream;
- char* cipherTextBuf;
+ char* cipherTextBuf = NULL;
int usernameLen;
int passwordLen;
int plainTextLen;
@@ -90,7 +90,10 @@
// cipherTextBuf length must be at least plainTextLen + 8
cipherTextLen = plainTextLen + 8;
- cipherTextBuf = (char*)malloc(cipherTextLen);
+ if ((cipherTextBuf = (char*)malloc(cipherTextLen)) == NULL) {
+ result = -1;
+ goto exit;
+ }
if(encrypt(plainTextStream.str(), plainTextLen, cipherTextBuf, cipherTextLen, &resultTextLen) != 0)
{
@@ -109,6 +112,7 @@
outFile.close();
exit:
+ free(cipherTextBuf);
return result;
}
@@ -119,8 +123,8 @@
fstream inFile;
PASS_INFO newPair;
strstream* plainTextStream;
- char* cipherTextBuf;
- char* plainTextBuf;
+ char* cipherTextBuf = NULL;
+ char* plainTextBuf = NULL;
int usernameLen;
int passwordLen;
int plainTextLen;
@@ -145,6 +149,12 @@
cipherTextBuf = (char*)malloc(cipherTextLen);
plainTextBuf = (char*)malloc(plainTextLen);
+ if ((cipherTextBuf == NULL) || (plainTextBuf == NULL)) {
+ result = -1;
+ inFile.close();
+ goto exit;
+ }
+
inFile.read(cipherTextBuf, cipherTextLen);
inFile.close();
@@ -183,6 +193,8 @@
delete plainTextStream;
exit:
+ free(cipherTextBuf);
+ free(plainTextBuf);
return result;
}
@@ -205,7 +217,6 @@
PK11Context* EncContext = NULL;
unsigned char gKey[] = KEY;
unsigned char gIV[] = IV;
- PK11SymKey* key = NULL;
SECItem keyItem;
SECItem ivItem;
CK_MECHANISM_TYPE cipherMech = CKM_DES_CBC_PAD;
@@ -234,6 +245,7 @@
SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL);
if(SymKey == NULL)
{
+ PK11_FreeSlot(slot);
result = PR_GetError();
goto exit;
}
@@ -247,6 +259,7 @@
if(SymKey != NULL)
{
PK11_FreeSymKey(SymKey);
+ PK11_FreeSlot(slot);
}
result = PR_GetError();
goto exit;
@@ -266,6 +279,7 @@
// Clean up
PK11_DestroyContext(EncContext, PR_TRUE);
PK11_FreeSymKey(SymKey);
+ PK11_FreeSlot(slot);
SECITEM_FreeItem(SecParam, PR_TRUE);
if((rv2 != SECSuccess) || (rv2 != SECSuccess))
@@ -288,7 +302,6 @@
PK11Context* EncContext = NULL;
unsigned char gKey[] = KEY;
unsigned char gIV[] = IV;
- PK11SymKey* key = NULL;
SECItem keyItem;
SECItem ivItem;
CK_MECHANISM_TYPE cipherMech = CKM_DES_CBC_PAD;
@@ -317,6 +330,7 @@
SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL);
if(SymKey == NULL)
{
+ PK11_FreeSlot(slot);
result = PR_GetError();
goto exit;
}
@@ -330,6 +344,7 @@
if(SymKey != NULL)
{
PK11_FreeSymKey(SymKey);
+ PK11_FreeSlot(slot);
}
result = PR_GetError();
goto exit;
@@ -349,6 +364,7 @@
// Clean up
PK11_DestroyContext(EncContext, PR_TRUE);
PK11_FreeSymKey(SymKey);
+ PK11_FreeSlot(slot);
SECITEM_FreeItem(SecParam, PR_TRUE);
if((rv2 != SECSuccess) || (rv2 != SECSuccess))
18 years
[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.25, 1.26
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9147
Modified Files:
create_instance.c
Log Message:
[185364] Can't update scripts (e.g., start-slapd) in the instance directory
Missing return at the end of create_scripts (success case)
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- create_instance.c 14 Mar 2006 17:13:38 -0000 1.25
+++ create_instance.c 16 Mar 2006 22:19:31 -0000 1.26
@@ -1060,7 +1060,7 @@
static char *
create_scripts(server_config_s *cf, char *param_name)
{
- char *t, *sroot = cf->sroot;
+ char *t = NULL, *sroot = cf->sroot;
char subdir[PATH_SIZE];
/* Create slapd-nickname directory */
@@ -1349,6 +1349,8 @@
"net start slapd-%s\n", cf->servid, cf->servid);
if(t) return t;
#endif /* XP_WIN32 */
+
+ return t; /* should be NULL */
}
/* ---------------------- Update server script files ---------------------- */
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldif2ldbm.c, 1.7, 1.8
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19757
Modified Files:
ldif2ldbm.c
Log Message:
[185477] ldif2db allows entries without a parent to be imported
if idl is NULL, changed add_op_attrs to always set IMPORT_ADD_OP_ATTRS_NO_PARENT in non-error case (err == 0 or err == DB_NOTFOUND)
Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ldif2ldbm.c 19 Apr 2005 22:07:38 -0000 1.7
+++ ldif2ldbm.c 16 Mar 2006 03:02:33 -0000 1.8
@@ -222,15 +222,15 @@
&err )) != NULL ) {
pid = idl_firstid( idl );
idl_free( idl );
- } else if ( 0 != err ) {
- if (DB_NOTFOUND != err ) {
+ } else {
+ /* empty idl */
+ if ( 0 != err && DB_NOTFOUND != err ) {
LDAPDebug( LDAP_DEBUG_ANY, "database error %d\n", err, 0, 0 );
slapi_ch_free( (void**)&pdn );
return( -1 );
- } else {
- if (NULL != status) {
- *status = IMPORT_ADD_OP_ATTRS_NO_PARENT;
- }
+ }
+ if (NULL != status) {
+ *status = IMPORT_ADD_OP_ATTRS_NO_PARENT;
}
}
slapi_ch_free( (void**)&pdn );
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm idl_new.c, 1.4, 1.4.2.1
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20632
Modified Files:
Tag: Directory71RtmBranch
idl_new.c
Log Message:
[185477] ldif2db allows entries without a parent to be imported
The problem is that the new IDL code is not exposing the DB_NOTFOUND error when
the index key is not found. Import checks if the result was DB_NOTFOUND when
checking for the parent entry's entrydn index. This works fine with the old
IDL code. (nkinder(a)redhat.com)
Index: idl_new.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/idl_new.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- idl_new.c 19 Apr 2005 22:07:38 -0000 1.4
+++ idl_new.c 15 Mar 2006 00:52:02 -0000 1.4.2.1
@@ -244,9 +244,7 @@
ret = cursor->c_get(cursor,&key,&data,DB_SET);
#endif
if (0 != ret) {
- if (DB_NOTFOUND == ret) {
- ret = 0;
- } else {
+ if (DB_NOTFOUND != ret) {
#ifdef DB_USE_BULK_FETCH
if (ret == ENOMEM) {
LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm idl_new.c, 1.4, 1.5
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20599
Modified Files:
idl_new.c
Log Message:
[185477] ldif2db allows entries without a parent to be imported
The problem is that the new IDL code is not exposing the DB_NOTFOUND error when
the index key is not found. Import checks if the result was DB_NOTFOUND when
checking for the parent entry's entrydn index. This works fine with the old
IDL code. (nkinder(a)redhat.com)
Index: idl_new.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/idl_new.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- idl_new.c 19 Apr 2005 22:07:38 -0000 1.4
+++ idl_new.c 15 Mar 2006 00:51:14 -0000 1.5
@@ -244,9 +244,7 @@
ret = cursor->c_get(cursor,&key,&data,DB_SET);
#endif
if (0 != ret) {
- if (DB_NOTFOUND == ret) {
- ret = 0;
- } else {
+ if (DB_NOTFOUND != ret) {
#ifdef DB_USE_BULK_FETCH
if (ret == ENOMEM) {
LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.9.2.3, 1.9.2.4 slap.h, 1.9, 1.9.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7327
Modified Files:
Tag: Directory71RtmBranch
saslbind.c slap.h
Log Message:
184585 - SASL context needs to be disposed of and a new one created when re-binding
Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -u -r1.9.2.3 -r1.9.2.4
--- saslbind.c 4 Nov 2005 18:57:48 -0000 1.9.2.3
+++ saslbind.c 14 Mar 2006 19:36:23 -0000 1.9.2.4
@@ -854,6 +854,37 @@
sasl_start:
+ /* Check if we are already authenticated via sasl. If so,
+ * dispose of the current sasl_conn and create a new one
+ * using the new mechanism. We also need to do this if the
+ * mechanism changed in the middle of the SASL authentication
+ * process. */
+ if ((pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE) || continuing) {
+ /* reset flag */
+ pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_COMPLETE;
+
+ /* Lock the connection mutex */
+ PR_Lock(pb->pb_conn->c_mutex);
+
+ /* remove any SASL I/O from the connection */
+ sasl_io_cleanup(pb->pb_conn);
+
+ /* dispose of sasl_conn and create a new sasl_conn */
+ sasl_dispose(&sasl_conn);
+ ids_sasl_server_new(pb->pb_conn);
+ sasl_conn = (sasl_conn_t*)pb->pb_conn->c_sasl_conn;
+
+ /* Unlock the connection mutex */
+ PR_Unlock(pb->pb_conn->c_mutex);
+
+ if (sasl_conn == NULL) {
+ send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
+ "sasl library unavailable", 0, NULL );
+ return;
+ }
+ }
+
+
rc = sasl_server_start(sasl_conn, mech,
cred->bv_val, cred->bv_len,
&sdata, &slen);
@@ -862,6 +893,8 @@
switch (rc) {
case SASL_OK: /* complete */
+ /* Set a flag to signify that sasl bind is complete */
+ pb->pb_conn->c_flags |= CONN_FLAG_SASL_COMPLETE;
/* retrieve the authenticated username */
if (sasl_getprop(sasl_conn, SASL_USERNAME,
Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -r1.9 -r1.9.2.1
--- slap.h 19 Apr 2005 22:07:37 -0000 1.9
+++ slap.h 14 Mar 2006 19:36:23 -0000 1.9.2.1
@@ -1268,6 +1268,10 @@
* Start TLS request operation.
*/
+#define CONN_FLAG_SASL_COMPLETE 32 /* Flag set when a sasl bind has been
+ * successfully completed.
+ */
+
#define START_TLS_OID "1.3.6.1.4.1.1466.20037"
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.15, 1.16
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7223
Modified Files:
saslbind.c
Log Message:
184585 - Adjusted the location of the connection lock when doing a sasl_rebind
Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- saslbind.c 14 Mar 2006 19:18:03 -0000 1.15
+++ saslbind.c 14 Mar 2006 19:32:15 -0000 1.16
@@ -887,12 +887,12 @@
* mechanism changed in the middle of the SASL authentication
* process. */
if ((pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE) || continuing) {
- /* Lock the connection mutex */
- PR_Lock(pb->pb_conn->c_mutex);
-
/* reset flag */
pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_COMPLETE;
+ /* Lock the connection mutex */
+ PR_Lock(pb->pb_conn->c_mutex);
+
/* remove any SASL I/O from the connection */
sasl_io_cleanup(pb->pb_conn);
18 years
[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.14, 1.15 slap.h, 1.11, 1.12
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6854
Modified Files:
saslbind.c slap.h
Log Message:
184585 - SASL context needs to be disposed of and a new one created when re-binding
Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- saslbind.c 10 Nov 2005 22:37:54 -0000 1.14
+++ saslbind.c 14 Mar 2006 19:18:03 -0000 1.15
@@ -881,6 +881,36 @@
sasl_start:
+ /* Check if we are already authenticated via sasl. If so,
+ * dispose of the current sasl_conn and create a new one
+ * using the new mechanism. We also need to do this if the
+ * mechanism changed in the middle of the SASL authentication
+ * process. */
+ if ((pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE) || continuing) {
+ /* Lock the connection mutex */
+ PR_Lock(pb->pb_conn->c_mutex);
+
+ /* reset flag */
+ pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_COMPLETE;
+
+ /* remove any SASL I/O from the connection */
+ sasl_io_cleanup(pb->pb_conn);
+
+ /* dispose of sasl_conn and create a new sasl_conn */
+ sasl_dispose(&sasl_conn);
+ ids_sasl_server_new(pb->pb_conn);
+ sasl_conn = (sasl_conn_t*)pb->pb_conn->c_sasl_conn;
+
+ /* Unlock the connection mutex */
+ PR_Unlock(pb->pb_conn->c_mutex);
+
+ if (sasl_conn == NULL) {
+ send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
+ "sasl library unavailable", 0, NULL );
+ return;
+ }
+ }
+
rc = sasl_server_start(sasl_conn, mech,
cred->bv_val, cred->bv_len,
&sdata, &slen);
@@ -889,6 +919,8 @@
switch (rc) {
case SASL_OK: /* complete */
+ /* Set a flag to signify that sasl bind is complete */
+ pb->pb_conn->c_flags |= CONN_FLAG_SASL_COMPLETE;
/* retrieve the authenticated username */
if (sasl_getprop(sasl_conn, SASL_USERNAME,
Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- slap.h 28 Feb 2006 21:51:26 -0000 1.11
+++ slap.h 14 Mar 2006 19:18:03 -0000 1.12
@@ -1271,6 +1271,9 @@
* Start TLS request operation.
*/
+#define CONN_FLAG_SASL_COMPLETE 32 /* Flag set when a sasl bind has been
+ * successfully completed.
+ */
#define START_TLS_OID "1.3.6.1.4.1.1466.20037"
18 years
[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.24, 1.25 create_instance.h, 1.5, 1.6 instindex.cpp, 1.8, 1.9
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1852
Modified Files:
create_instance.c create_instance.h instindex.cpp
Log Message:
[185364] Can't update scripts (e.g., start-slapd) in the instance
When ds_create is called with -r (update), scripts in the instance directory
were not updated. They are recreated with this change.
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- create_instance.c 7 Dec 2005 21:29:08 -0000 1.24
+++ create_instance.c 14 Mar 2006 17:13:38 -0000 1.25
@@ -1057,74 +1057,15 @@
}
#endif
-/* ---------------------- Create configuration files ---------------------- */
-
-
-char *create_server(server_config_s *cf, char *param_name)
+static char *
+create_scripts(server_config_s *cf, char *param_name)
{
- char line[PATH_SIZE], *t, *sroot = cf->sroot;
+ char *t, *sroot = cf->sroot;
char subdir[PATH_SIZE];
-#if defined( SOLARIS )
- /*
- * Solaris 9+ specific installation
- */
- char otherline[PATH_SIZE];
- char subdirvar[PATH_SIZE];
- char subdiretc[PATH_SIZE];
- char *sub;
-#endif /* SOLARIS */
-
- if (param_name)
- param_name[0] = 0; /* init to empty string */
-
-#ifdef XP_UNIX
- if (!cf->servuser)
- getSuiteSpotUserGroup(cf);
-#else
- /* Abort if the service exists on NT */
- if (t = service_exists(cf->servid)) {
- PL_strncpyz(param_name, "servid", BIG_LINE);
- return t;
- }
-#endif
-
- if( (t = sanity_check(cf, param_name)) )
- return t;
-
/* Create slapd-nickname directory */
PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP,
cf->servid);
- if( (create_instance_mkdir(subdir, NEWDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", subdir, ds_system_errmsg());
-
- /* Create slapd-nickname/config directory */
- PR_snprintf(line, sizeof(line), "%s%cconfig", subdir, FILE_PATHSEP);
- if( (create_instance_mkdir(line, NEWDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-
- /* Create slapd-nickname/config/schema directory */
- PR_snprintf(line, sizeof(line), "%s%cconfig%cschema", subdir, FILE_PATHSEP, FILE_PATHSEP);
- if( (create_instance_mkdir(line, NEWDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-
-#if defined (BUILD_PRESENCE)
- /* Create slapd-nickname/config/presence directory */
- PR_snprintf(line, sizeof(line), "%s%cconfig%cpresence", subdir, FILE_PATHSEP, FILE_PATHSEP);
- if( (create_instance_mkdir(line, NEWDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-#endif
-
- /* Create slapd-nickname/logs directory */
- PR_snprintf(line, sizeof(line), "%s%clogs", subdir, FILE_PATHSEP);
- if( (create_instance_mkdir(line, NEWSECDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-
- /* Create httpacl directory */
- PR_snprintf(line, sizeof(line), "%s%chttpacl", cf->sroot, FILE_PATHSEP);
- if( (create_instance_mkdir(line, NEWDIR_MODE)) )
- return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-
#ifdef XP_UNIX
/* Start/stop/rotate/restart scripts */
if (getenv("USE_DEBUGGER"))
@@ -1180,17 +1121,6 @@
subdir,
cf->loglevel ? cf->loglevel : "0"
);
-/*
- t = gen_script(subdir, START_SCRIPT,
- "NETSITE_ROOT=%s\n"
- "export NETSITE_ROOT\n"
- "cd %s/bin/%s/server; /usr/bin/X11/xterm -fn 10x20 -sb -sl 2000 -e /bin/ladebug "
- "-I /u/richm/ds50/ldapserver/ldap/servers/slapd/back-ldbm "
- "-I /u/richm/ds50/ldapserver/ldap/servers/slapd "
- "%s &\n",
- sroot, sroot, PRODUCT_NAME, PRODUCT_BIN
- );
-*/
#else
t = gen_script(subdir, START_SCRIPT,
"\n"
@@ -1418,12 +1348,137 @@
t = gen_script(subdir, RESTART_SCRIPT".bat", "net stop slapd-%s\n"
"net start slapd-%s\n", cf->servid, cf->servid);
if(t) return t;
+#endif /* XP_WIN32 */
+}
+/* ---------------------- Update server script files ---------------------- */
+int update_server(server_config_s *cf)
+{
+ char line[PATH_SIZE], *t, *sroot = cf->sroot;
+ char subdir[PATH_SIZE];
+ char error_param[BIG_LINE] = {0};
-#endif /* XP_WIN32 */
+#if defined( SOLARIS )
+ /*
+ * Solaris 9+ specific installation
+ */
+ char otherline[PATH_SIZE];
+ char subdirvar[PATH_SIZE];
+ char subdiretc[PATH_SIZE];
+ char *sub;
+#endif /* SOLARIS */
-#ifdef XP_WIN32
+ error_param[0] = 0; /* init to empty string */
+
+#ifdef XP_UNIX
+ if (!cf->servuser)
+ getSuiteSpotUserGroup(cf);
+#else
+ /* Abort if the service exists on NT */
+ if (t = service_exists(cf->servid)) {
+ PL_strncpyz(error_param, "servid", BIG_LINE);
+ goto out;
+ }
+#endif
+
+ if( (t = sanity_check(cf, error_param)) )
+ goto out;
+
+ t = create_scripts(cf, error_param);
+ if(t) goto out;
+
+out:
+ if(t)
+ {
+ char *msg;
+ if (error_param[0])
+ {
+ msg = PR_smprintf("%s.error:could not update server %s - %s",
+ error_param, cf->servid, t);
+ }
+ else
+ {
+ msg = PR_smprintf("error:could not update server %s - %s",
+ cf->servid, t);
+ }
+ ds_show_message(msg);
+ PR_smprintf_free(msg);
+ return 1;
+ }
+ else
+ return 0;
+}
+
+/* ---------------------- Create configuration files ---------------------- */
+char *create_server(server_config_s *cf, char *param_name)
+{
+ char line[PATH_SIZE], *t, *sroot = cf->sroot;
+ char subdir[PATH_SIZE];
+
+#if defined( SOLARIS )
+ /*
+ * Solaris 9+ specific installation
+ */
+ char otherline[PATH_SIZE];
+ char subdirvar[PATH_SIZE];
+ char subdiretc[PATH_SIZE];
+ char *sub;
+#endif /* SOLARIS */
+
+ if (param_name)
+ param_name[0] = 0; /* init to empty string */
+
+#ifdef XP_UNIX
+ if (!cf->servuser)
+ getSuiteSpotUserGroup(cf);
+#else
+ /* Abort if the service exists on NT */
+ if (t = service_exists(cf->servid)) {
+ PL_strncpyz(param_name, "servid", BIG_LINE);
+ return t;
+ }
+#endif
+
+ if( (t = sanity_check(cf, param_name)) )
+ return t;
+
+ /* Create slapd-nickname directory */
+ PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP,
+ cf->servid);
+ if( (create_instance_mkdir(subdir, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", subdir, ds_system_errmsg());
+
+ /* Create slapd-nickname/config directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig", subdir, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+
+ /* Create slapd-nickname/config/schema directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig%cschema", subdir, FILE_PATHSEP, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+
+#if defined (BUILD_PRESENCE)
+ /* Create slapd-nickname/config/presence directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig%cpresence", subdir, FILE_PATHSEP, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+#endif
+ /* Create slapd-nickname/logs directory */
+ PR_snprintf(line, sizeof(line), "%s%clogs", subdir, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWSECDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+
+ /* Create httpacl directory */
+ PR_snprintf(line, sizeof(line), "%s%chttpacl", cf->sroot, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+
+ t = create_scripts(cf, param_name);
+ if(t) return t;
+
+#ifdef XP_WIN32
if ( INFO_GetOperatingSystem () == OS_WINNT ) {
if( (t = add_ntservice(cf)) )
Index: create_instance.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- create_instance.h 19 Apr 2005 22:06:55 -0000 1.5
+++ create_instance.h 14 Mar 2006 17:13:38 -0000 1.6
@@ -132,6 +132,10 @@
additional detail
*/
char *create_server(server_config_s *cf, char *param_name);
+/*
+ Update script files in the instance directory
+*/
+int update_server(server_config_s *cf);
/* from script-gen.c */
int generate_script(const char *inpath, const char *outpath, int mode,
Index: instindex.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/instindex.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- instindex.cpp 19 Apr 2005 22:06:55 -0000 1.8
+++ instindex.cpp 14 Mar 2006 17:13:38 -0000 1.9
@@ -134,12 +134,16 @@
else
fclose(infFile);
+ if (!status)
+ status = create_config_from_inf(&cf, argc, argv);
if (reconfig)
- status = reconfigure_instance(argc, argv);
- else
{
+ status = update_server(&cf);
if (!status)
- status = create_config_from_inf(&cf, argc, argv);
+ status = reconfigure_instance(argc, argv);
+ }
+ else
+ {
if (!status)
status = create_config(&cf);
if (!status)
18 years
[Fedora-directory-commits] mod_admserv configure,1.18,1.19
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/mod_admserv
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6958
Modified Files:
configure
Log Message:
adding "@nspr_lib@ -lnspr4 -lplc4" to LIBS to build using components on /s/b/c.
18 years