summaryrefslogtreecommitdiffstats
path: root/ldap/admin/src
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2007-06-13 01:26:58 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2007-06-13 01:26:58 +0000
commitad1a3df37851e131e3570cb98d884b3e01fa89ad (patch)
tree906e785ce517930234cd52ea1a54cdab67e5d6c3 /ldap/admin/src
parentee19ccbf7cfa42ff8b684b5e9de4c9d2f7d8145e (diff)
downloadds-ad1a3df37851e131e3570cb98d884b3e01fa89ad.tar.gz
ds-ad1a3df37851e131e3570cb98d884b3e01fa89ad.tar.xz
ds-ad1a3df37851e131e3570cb98d884b3e01fa89ad.zip
Resolves: #237356
Summary: Move DS Admin Code into Admin Server (Comment #54) Description: 1) eliminated the code adding o=netscaperoot related entries from cfg_sspt.c. 2) moving DS task CGIs to the adminserver.
Diffstat (limited to 'ldap/admin/src')
-rw-r--r--ldap/admin/src/addindex.c123
-rw-r--r--ldap/admin/src/cfg_sspt.c225
-rw-r--r--ldap/admin/src/ds_bak2db.c108
-rw-r--r--ldap/admin/src/ds_db2bak.c115
-rw-r--r--ldap/admin/src/ds_db2ldif.c115
-rw-r--r--ldap/admin/src/ds_ldif2db.c146
-rw-r--r--ldap/admin/src/ds_listdb.c74
-rw-r--r--ldap/admin/src/ds_remove.c271
-rw-r--r--ldap/admin/src/ds_rmdb.c112
-rw-r--r--ldap/admin/src/ds_snmpctrl.c345
-rw-r--r--ldap/admin/src/restart.c83
-rw-r--r--ldap/admin/src/shutdown.c76
-rw-r--r--ldap/admin/src/start.c76
-rw-r--r--ldap/admin/src/vlvindex.c129
14 files changed, 5 insertions, 1993 deletions
diff --git a/ldap/admin/src/addindex.c b/ldap/admin/src/addindex.c
deleted file mode 100644
index 4a3d0dff..00000000
--- a/ldap/admin/src/addindex.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * addindex.c: Creates one or more indexes for specified attributes
- *
- * Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-#include "nspr.h"
-
-int main(int argc, char *argv[])
-{
- int status;
- char *attributes;
- char *attrs;
- char **attrList;
- int nAttrs;
- char *nextAttr = NULL;
- char *backendName;
-
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- /*
- * Get value of the "attributes" variable.
- */
- attributes = ds_get_cgi_var("attributes");
- if ( (NULL == attributes) || (strlen(attributes) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "attributes", NULL, NULL );
- return 1;
- }
-
-
- backendName = ds_get_cgi_var("backendID");
- if ( (NULL == backendName) || (strlen(backendName) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "backendName", NULL, NULL );
- return 1;
- }
-
-
- attrs = strdup( attributes );
- if (attrs == NULL) {
- rpt_err(DS_MEMORY_ERROR, "Out of memory!", NULL, NULL);
- return 1;
- }
-
- /* Allocate for worst possible case */
- attrList = (char **)malloc(sizeof(*attrList) * (strlen(attrs)+1));
- nAttrs = 0;
- /* strtok() is not MT safe, but it is okay to call here because this is a command line */
- attrList[nAttrs++] = strtok( attrs, " " );
- do {
- nextAttr = strtok( NULL, " " );
- attrList[nAttrs++] = nextAttr;
- } while( nextAttr != NULL );
-
- ds_send_status((nAttrs > 1) ? "Creating indexes ..." :
- "Creating index ...");
-
- status = ds_addindex( attrList, backendName );
-
- if ( !status ) {
- rpt_success((nAttrs > 1) ? "Success! The indexes have been created." :
- "Success! The index has been created.");
- status = 0;
- } else {
- char msg[BIG_LINE];
- PR_snprintf( msg, sizeof(msg), "[%s] %s", backendName, attributes);
- rpt_err( status, msg, NULL, NULL );
- status = 1;
- }
-
- return status;
-}
diff --git a/ldap/admin/src/cfg_sspt.c b/ldap/admin/src/cfg_sspt.c
index 553fc6e7..2bd6ab2d 100644
--- a/ldap/admin/src/cfg_sspt.c
+++ b/ldap/admin/src/cfg_sspt.c
@@ -93,14 +93,11 @@ char* const name_c = "c";
char* const name_st = "st";
char* const name_l = "l";
-char* const value_configAdminGroupCN = "Configuration Administrators";
-char* const value_configAdminGroupRDN = "cn=Configuration Administrators";
-char* const value_configAdminCN = "Configuration Administrator";
-char* const value_configAdminSN = "Administrator";
-char* const value_configAdminGN = "Configuration";
-char* const value_globalPreferencesOU = "Global Preferences";
-char* const value_hostPreferencesOU = "Host Preferences";
-char* const value_netscapeConfigDesc = "Standard branch for configuration information";
+char* const name_netscaperootDN = "o=NetscapeRoot";
+
+char* const value_configAdminCN = "Configuration Administrator";
+char* const value_configAdminSN = "Administrator";
+char* const value_configAdminGN = "Configuration";
char* const value_peopleOU = "People";
char* const value_peopleDesc = "Standard branch for people (uid) entries";
char* const value_groupsOU = "Groups";
@@ -112,14 +109,6 @@ char* const value_config40DN = "cn=config40";
char* dbg_log_file = "ds_sscfg.log";
-char* const name_netscaperoot = "NetscapeRoot";
-char* const name_netscaperootDN = "o=NetscapeRoot";
-char* const name_topology = "TopologyManagement";
-char* const name_topologyRDN = "ou=TopologyManagement";
-char* const value_topologyDESC = "Branch for Configuration Administration users and groups";
-char* const name_administratorsOU = "Administrators";
-char* const name_administratorsRDN = "ou=Administrators";
-char* const value_administratorsDESC = "Standard branch for Configuration Administrator (uid) entries";
char* const name_localDAGroup = "Directory Administrators";
char* const value_localDAGroupDesc = "Entities with administrative access to this directory server";
@@ -994,70 +983,6 @@ create_base(LDAP* ld, char* base)
return ret;
}
-static int
-create_NetscapeRoot(LDAP* ld, const char *DN)
-{
-/*
- dn: o=NetscapeRoot
- o: NetscapeRoot
- objectclass: top
- objectclass: organization
- */
- int err;
- int ret = 0;
-
-#ifdef CGI_DEBUG
- debug_log (dbg_log_file, "create_NetscapeRoot()\n");
-#endif
-
- if (ld == NULL)
- {
- return -1;
- }
-
- if (!entry_exists(ld, DN))
- {
- LDAPMod* attrs[4];
- LDAPMod attr[3];
- char* objectClasses[4];
- char* names[2];
-
- attrs[0] = &attr[0];
- attrs[3] = NULL;
- attr[0].mod_op = LDAP_MOD_ADD;
- attr[0].mod_type = name_objectClass;
- attr[0].mod_values = objectClasses;
- objectClasses[0] = class_top;
- objectClasses[1] = class_organization;
- objectClasses[2] = NULL;
- attrs[1] = &attr[1];
- attr[1].mod_op = LDAP_MOD_ADD;
- attr[1].mod_type = name_o;
- attr[1].mod_values = names;
- names[0] = name_netscaperoot;
- names[1] = NULL;
- attrs[2] = NULL;
-
- /* fprintf (stdout, "ldap_add_s(%s)<br>\n", DN); fflush (stdout); */
-
- err = ldap_add_s (ld, DN, attrs);
-
- if (err != LDAP_SUCCESS)
- {
- char* explanation = PR_smprintf("Unable to create %s."
- " (%s (%i) returned from ldap_add_s(%s))",
- name_netscaperoot, ldap_err2string (err), err,
- DN);
- ds_report_warning (DS_NETWORK_ERROR, " can't create NetscapeRoot",
- explanation);
- PR_smprintf_free (explanation);
- ret = 1;
- }
-
- }
-
- return ret;
-}
#ifdef TEST_CONFIG
static int
@@ -1405,28 +1330,6 @@ config_suitespot(SLAPD_CONFIG* slapd, QUERY_VARS* query)
if (!(connection = do_bind (slapd, query->rootDN, query->rootPW)))
return 1;
- /* parent dn of admin uid entry */
- if (query->netscaperoot) {
- parentDN = make_dn("%s, %s, %s", name_administratorsRDN,
- name_topologyRDN, query->netscaperoot, NULLSTR);
- }
-
- if (query->config_admin_uid) {
- getUIDFromDN(query->config_admin_uid, realuid);
- if (realuid[0]) {
- /* admid is already a DN */
- configAdminDN = strdup(query->config_admin_uid);
- } else if (parentDN) {
- /* create a DN for admid */
- configAdminDN = make_dn(DN_formatUID, query->config_admin_uid, parentDN, NULLSTR);
- } else {
- /* create one from scratch */
- configAdminDN = make_dn("%s=%s, %s, %s, %s", name_uid, query->config_admin_uid,
- name_administratorsRDN, name_topologyRDN,
- name_netscaperootDN, NULLSTR);
- }
- }
-
if (query->suffix)
{
status = create_base(connection, query->suffix);
@@ -1448,16 +1351,6 @@ config_suitespot(SLAPD_CONFIG* slapd, QUERY_VARS* query)
if (!status)
{
- /*
- Give the Configuration Admin group access to the root DSE entries
- */
- if (query->netscaperoot) {
- adminGroupDN = make_dn("%s, %s=%s, %s, %s", value_configAdminGroupRDN,
- name_ou, value_groupsOU,
- name_topologyRDN,
- query->netscaperoot, NULLSTR);
- }
-
if (query->suffix)
{
localDAGroupDN = make_dn("cn=%s, %s", name_localDAGroup,
@@ -1491,114 +1384,6 @@ config_suitespot(SLAPD_CONFIG* slapd, QUERY_VARS* query)
}
}
- if (query->cfg_sspt)
- {
- /* create and set ACIs for o=netscaperoot entry */
- if (!status)
- status = create_NetscapeRoot(connection, query->netscaperoot);
-
- if (!status)
- status = add_aci_v(connection, query->netscaperoot,
- ACI_config_admin_group_allow_all,
- value_configAdminGroupRDN,
- name_ou, value_groupsOU, name_topologyRDN,
- query->netscaperoot, NULLSTR);
-
- if (!status)
- status = add_aci_v(connection, query->netscaperoot,
- ACI_anonymous_allow_with_filter,
- query->netscaperoot, NULLSTR);
-
- if (!status)
- status = add_aci_v(connection, query->netscaperoot, ACI_group_expansion,
- query->netscaperoot, NULLSTR);
-
- /* create "topologyOU, netscaperoot" entry and set ACIs */
- if (!status)
- {
- char *dn = make_dn("%s, %s", name_topologyRDN,
- query->netscaperoot, NULLSTR);
- status = create_organizational_unit(connection, NULL, dn,
- value_topologyDESC,
- 0, 0, 0);
-
- if (!status)
- add_aci(connection, dn, ACI_anonymous_allow);
-
- free(dn);
- }
-
- /* create "ou=Groups, ..." */
- if (!status)
- {
- char *dn = make_dn("%s=%s, %s, %s", name_ou, value_groupsOU,
- name_topologyRDN, query->netscaperoot, NULLSTR);
- status = create_organizational_unit (connection, NULL, dn,
- value_groupsDesc, 0, 0, 0);
- free(dn);
- }
-
- /* create "ou=Administrators, ..." */
- if (!status)
- {
- char *dn = make_dn("%s, %s, %s", name_administratorsRDN,
- name_topologyRDN, query->netscaperoot, NULLSTR);
- status = create_organizational_unit (connection, NULL, dn,
- value_administratorsDESC,
- 0, 0, 0);
- free(dn);
- }
-
- /* create "cn=Configuration Administrators, ou=Groups, ..." */
- if (!status)
- {
- char *dn = make_dn("%s=%s, %s, %s", name_ou, value_groupsOU,
- name_topologyRDN,
- query->netscaperoot, NULLSTR);
- status = create_group (connection, dn, value_configAdminGroupCN);
- free(dn);
- }
-
- /* create the ss admin user */
- if (!status && !is_root_user(query->ssAdmID, query))
- {
- /* group to add the uid to */
- char *groupdn = make_dn("%s, %s=%s, %s, %s", value_configAdminGroupRDN,
- name_ou, value_groupsOU, name_topologyRDN,
- query->netscaperoot, NULLSTR);
- create_ssadmin_user(connection, parentDN,
- query->ssAdmID, query->ssAdmPW1);
-
- status = add_group_member (connection, groupdn,
- name_uniqueMember, configAdminDN);
- free (groupdn);
- }
-
- admin_domainDN = make_dn("%s=%s, %s", name_ou, query->admin_domain,
- query->netscaperoot, NULLSTR);
-
- if (!status)
- status = create_organizational_unit (connection, 0,
- admin_domainDN,
- value_netscapeConfigDesc,
- class_adminDomain,
- name_adminDomain,
- query->admin_domain);
-
- if (!status) {
- status = create_organizational_unit(connection,
- admin_domainDN,
- value_globalPreferencesOU, 0,
- 0, 0, 0);
- }
- if (!status) {
- status = create_organizational_unit(connection,
- admin_domainDN,
- value_hostPreferencesOU, 0,
- 0, 0, 0);
- }
- }
-
#ifdef TEST_CONFIG
if (!status && query->testconfig)
status = create_configEntry(connection);
diff --git a/ldap/admin/src/ds_bak2db.c b/ldap/admin/src/ds_bak2db.c
deleted file mode 100644
index 39021dbd..00000000
--- a/ldap/admin/src/ds_bak2db.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * Restores a database.
- *
- * Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-
-int main(int argc, char *argv[])
-{
- int isrunning;
- char *filename = NULL;
- int status;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- /*
- * Get value of the "filename" variable.
- */
- filename = ds_get_cgi_var("filename");
- if ( (NULL == filename) || (strlen(filename) < 1) ) {
- fprintf(stdout, "Environment variable filename not defined.\n");
- rpt_err( DS_UNDEFINED_VARIABLE, "filename", NULL, NULL );
- return 1;
- }
-
- /* Check if server is up */
- isrunning = ds_get_updown_status();
-
- /* Stop it, if so */
- if (isrunning != DS_SERVER_DOWN) {
- status = ds_bring_down_server();
- if(status != DS_SERVER_DOWN) {
- rpt_err( DS_SERVER_MUST_BE_DOWN, filename, NULL, NULL );
- return 1;
- }
- }
-
- ds_send_status("restoring database ...");
- status = ds_bak2db(filename);
-
- if ( !status ) {
- rpt_success("Success! The database has been restored.");
- status = 0;
- } else {
- rpt_err( status, filename, NULL, NULL );
- status = 1;
- }
-
- /* Restart the server if we brought it down */
- if (isrunning != DS_SERVER_DOWN) {
- if(ds_bring_up_server(1) != DS_SERVER_UP) {
- ds_send_status( "An error occurred during startup" );
- }
- }
- return status;
-}
diff --git a/ldap/admin/src/ds_db2bak.c b/ldap/admin/src/ds_db2bak.c
deleted file mode 100644
index a8e280b9..00000000
--- a/ldap/admin/src/ds_db2bak.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * Backs up the database.
- *
- * Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-#ifdef XP_UNIX
-#include <unistd.h>
-#endif
-#include "nspr.h"
-
-int main(int argc, char *argv[])
-{
- char *filename = NULL;
- int status;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- /*
- * Get value of the "filename" variable.
- */
- filename = ds_get_cgi_var("filename");
- if ( (NULL == filename) || (strlen(filename) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "filename", NULL, NULL );
- return 1;
- }
-
- ds_become_localuser (ds_get_config (DS_REAL_CONFIG));
-
-#define NEWDIR_MODE 0755
- /* Attempt to detect up front if file cannot be written */
- status = -1;
- /* Attempt to create the backup directory */
- if ( 0 == ds_mkdir_p(filename, NEWDIR_MODE) ) {
- char foo[256];
- FILE *f;
- /* Now attempt to create a file there (the directory might
- already have existed */
- PR_snprintf( foo, sizeof(foo), "%s%c%s", filename, FILE_PATHSEP, "foo" );
- f = fopen(foo, "w");
- if ( NULL != f ) {
- status = 0;
- fclose( f );
- unlink( foo );
- }
- }
- if ( status ) {
- rpt_err( DS_CANNOT_CREATE_FILE, filename, NULL, NULL );
- return 1;
- }
-
- ds_send_status("backing up database ...");
-
- status = ds_db2bak( filename ); /* prints errors as needed */
-
- if ( !status ) {
- rpt_success("Success! The database has been backed up.");
- return 0;
- } else {
- rpt_err( status, filename, NULL, NULL );
- return 1;
- }
-}
diff --git a/ldap/admin/src/ds_db2ldif.c b/ldap/admin/src/ds_db2ldif.c
deleted file mode 100644
index 031ee2dc..00000000
--- a/ldap/admin/src/ds_db2ldif.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * Converts the database into an ldif file.
- *
- * Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-#ifdef XP_UNIX
-#include <unistd.h>
-#endif
-
-int main(int argc, char *argv[])
-{
- char *filename = NULL;
- char *subtree = NULL;
- int status;
- FILE *f;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- /*
- * Get value of the "filename" variable.
- */
- filename = ds_get_cgi_var("filename");
- if ( (NULL == filename) || (strlen(filename) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "filename", NULL, NULL );
- return 1;
- }
-
- ds_become_localuser (ds_get_config (DS_REAL_CONFIG));
-
- /* Attempt to detect up front if file cannot be written */
- f = fopen(filename, "w");
- if ( NULL != f ) {
- fclose( f );
- unlink( filename );
- } else {
- rpt_err( DS_CANNOT_CREATE_FILE, filename, NULL, NULL );
- return 1;
- }
-
- /*
- * Get value of the "subtree" variable.
- */
- subtree = ds_get_cgi_var("subtree");
-
- ds_send_status("creating LDIF file ...");
-
- if ( (subtree != NULL) && (*subtree != 0) ) {
- char *escaped = ds_escape_for_shell( subtree );
- status = ds_db2ldif_subtree(filename, escaped);
- free( escaped );
- } else {
- status = ds_db2ldif(filename); /* prints errors as needed */
- }
-
- if ( !status ) {
- rpt_success("Success! The database has been exported.");
- return 0;
- } else {
- rpt_err( status, filename, NULL, NULL );
- return 1;
- }
-}
diff --git a/ldap/admin/src/ds_ldif2db.c b/ldap/admin/src/ds_ldif2db.c
deleted file mode 100644
index aef7fed8..00000000
--- a/ldap/admin/src/ds_ldif2db.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * ds_ldif2db.c: Converts an ldif file into a database.
- *
- * Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-#ifdef XP_UNIX
-#include <unistd.h>
-#endif
-#ifdef XP_WIN32
-#include <io.h>
-#endif
-
-int main(int argc, char *argv[])
-{
- int isrunning;
- char *filename = NULL;
- char *saveconfig = NULL;
- int preserve;
- int status;
-
- setbuf(stdout, 0);
-#ifdef DEBUG_CGI
- freopen("\\tmp\\stderr.out", "w", stderr);
-#else
- dup2(fileno(stdout), fileno(stderr));
-#endif /* DEBUG_CGI */
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- /*
- * Get value of the "filename" variable.
- */
- filename = ds_get_cgi_var("filename");
- if ( (NULL == filename) || (strlen(filename) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "filename", NULL, NULL );
- return 1;
- }
-
-#ifdef DEBUG_CGI
- fprintf(stderr, "filename=%s\n", filename);
-#endif /* DEBUG_CGI */
-
- /*
- * Get value of the "saveconfig" variable.
- */
- saveconfig = ds_get_cgi_var("saveconfig");
- preserve = ( (saveconfig == NULL) || !(strcmp(saveconfig,"true")) );
-
-#ifdef DEBUG_CGI
- fprintf(stderr, "preserve=%d\n", preserve);
-#endif /* DEBUG_CGI */
-
- /* Check if server is up */
- isrunning = ds_get_updown_status();
-
-#ifdef DEBUG_CGI
- fprintf(stderr, "isrunning=%d\n", isrunning);
-#endif /* DEBUG_CGI */
-
- /* Stop it, if so */
- if (isrunning != DS_SERVER_DOWN) {
- status = ds_bring_down_server();
-#ifdef DEBUG_CGI
- fprintf(stderr, "status=%d\n", status);
-#endif /* DEBUG_CGI */
- if(status != DS_SERVER_DOWN) {
- rpt_err( DS_SERVER_MUST_BE_DOWN, filename, NULL, NULL );
- return 1;
- }
- }
-
- ds_send_status("creating database ...");
- if ( preserve )
- status = ds_ldif2db_preserve(filename); /* prints errors as needed */
- else
- status = ds_ldif2db(filename); /* prints errors as needed */
-
- if ( !status ) {
- rpt_success("Success! The database has been imported.");
- status = 0;
- } else {
- rpt_err( status, filename, NULL, NULL );
- status = 1;
- }
-
- /* Restart the server if we brought it down */
- if (isrunning != DS_SERVER_DOWN) {
- int retval;
- if((retval=ds_bring_up_server(1)) != DS_SERVER_UP) {
- ds_send_status( "An error occurred during startup" );
- }
- }
- return status;
-}
diff --git a/ldap/admin/src/ds_listdb.c b/ldap/admin/src/ds_listdb.c
deleted file mode 100644
index fc44d5d3..00000000
--- a/ldap/admin/src/ds_listdb.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * List the database backup directories.
- * No HTML - this is for DS 4.0.
- *
- * Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "dsalib.h"
-
-int main(int argc, char *argv[], char *envp[])
-{
- char **bak_dirs;
-
- ds_become_localuser (ds_get_config (DS_REAL_CONFIG));
-
- /* Tell the receiver we are about to start sending data */
- fprintf(stdout, "\n");
- bak_dirs = ds_get_bak_dirs();
- if ( bak_dirs != NULL ) /* no error */ {
- char **cur_file = bak_dirs;
- while ( *cur_file != NULL ) {
- fprintf(stdout, "%s\n", *cur_file);
- cur_file++;
- }
- }
-
- ds_become_original();
-
- return 0;
-}
diff --git a/ldap/admin/src/ds_remove.c b/ldap/admin/src/ds_remove.c
deleted file mode 100644
index 660104bc..00000000
--- a/ldap/admin/src/ds_remove.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * Remove the server
- *
- * Prasanta Behera
- */
-#ifdef XP_WIN32
-#include <windows.h>
-#include <io.h>
-#include "regparms.h"
-extern BOOL DeleteServer(LPCSTR pszServiceId);
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#ifdef XP_UNIX
-#include <sys/errno.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#else
-#endif /* WIN32? */
-#include <sys/stat.h>
-
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include "ds_remove_uninst.h"
-
-
-#include "nspr.h"
-
-/* this will be set to 1 if we need to retry the
- rm -rf of the instance directory again */
-static int try_rm_rf_again = 0;
-
-static int
-rm_rf_err_func(const char *path, const char *op, void *arg)
-{
- PRInt32 errcode = PR_GetError();
- char *msg;
- const char *errtext;
-
- if (!errcode || (errcode == PR_UNKNOWN_ERROR)) {
- errcode = PR_GetOSError();
- errtext = ds_system_errmsg();
- } else {
- errtext = PR_ErrorToString(errcode, PR_LANGUAGE_I_DEFAULT);
- }
-
- /* ignore "file or directory already removed" errors */
- if (errcode != PR_FILE_NOT_FOUND_ERROR) {
- msg = PR_smprintf("%s %s: error code %d (%s)", op, path, errcode, errtext);
- ds_send_error(msg, 0);
- PR_smprintf_free(msg);
- }
-
- /* On Windows and HPUX, if the file/directory to remove is opened by another
- application, it cannot be removed and will generate a busy error
- This usually happens when we attempt to stop slapd then remove the
- instance directory, but for some reason the process still has some
- open files
- In this case, we need to wait for some period of time then attempt to
- remove the instance directory again
- */
- if (errcode == PR_FILE_IS_BUSY_ERROR) {
- try_rm_rf_again = 1;
- return 0; /* just abort the operation */
- }
-
-#ifdef XP_WIN32
- /* on windows, err 145 means dir not empty
- 145 The directory is not empty. ERROR_DIR_NOT_EMPTY
- If there was a busy file, it wasn't able to be
- removed, so when we go to remove the directory, it
- won't be empty
- */
- if (errcode == ERROR_DIR_NOT_EMPTY) {
- if (try_rm_rf_again) {
- return 0; /* don't continue */
- }
- }
-#else /* unix */
- if (errcode == EEXIST) { /* not empty */
- if (try_rm_rf_again) {
- return 0; /* don't continue */
- }
- }
-#endif
-
- return 1; /* just continue */
-}
-
-int main(int argc, char *argv[])
-{
- int status = -1;
- char *servername;
- char *installroot;
- int isRunning;
-#ifndef __LP64__
-#if defined(__hpux) && !defined(__ia64)
- _main();
-#endif
-#endif
-
-#ifdef XP_WIN32
- if ( getenv("DEBUG_DSINST") )
- DebugBreak();
-#endif
-
- /* case 1: being called as program -f inffile */
- if (argc > 2 && argv[1][0] == '-' && argv[1][1] == 'f')
- {
- FILE *infFile = fopen(argv[2], "r");
- if (!infFile)
- {
- ds_report_error (DS_INCORRECT_USAGE, argv[2],
- "This file could not be opened. A valid file must be given.");
- status = 1;
-
- return status;
- }
- else
- fclose(infFile);
-
- ds_uninst_set_cgi_env(argv[2]);
- } else if (getenv("REQUEST_METHOD")) { /* case 2: called as a CGI */
- fprintf(stdout, "Content-type: text/html\n\n");
- fflush(stdout);
- } else { /* case 3: run from the command line */
- /* when being run from the command line, we require many command line arguments */
- /* we need to do 2 or three things:
- 1 - stop the server and remove the server instance directory
- 2 - remove the server's information from the config ds
- 3 - On Windows, remove the registry information
- We require the instance name as an argument. We also need the following:
- For 1, we need the server root
- For 2, we need the config ds host, port, admin domain, admin dn, admin password
- For 3, just the instance name
-
- There are two other arguments that are optional. -force will ignore errors and just keep
- going. On Windows, -allreg will clean up all known registry information for all instances
- of DS on this machine
- */
- }
-
-
- if ( init_ds_env() ) {
- return 1;
- }
-
- /*
- * Get the server path to delete.
- * serverpath = /<server_root>/slapd-<id>
- */
- if (!(servername = ds_get_cgi_var("InstanceName")))
- servername = ds_get_server_name();
-
- /* Check again if the serevr is down or not */
- if((isRunning = ds_get_updown_status()) == DS_SERVER_UP) {
- if ((status = ds_bring_down_server()) != DS_SERVER_DOWN) {
- char buf[1024];
- PR_snprintf(buf, sizeof(buf), "Could not stop server: error %d", status);
- ds_report_error (DS_GENERAL_FAILURE, servername, buf);
- return 1;
- }
- }
-
- if (servername) {
- char line[1024];
- int busy_retries = 3; /* if busy, retry this many times */
- installroot = ds_get_install_root();
- /* We may get busy errors if files are in use when we try
- to remove them, so if that happens, sleep for 30 seconds
- and try again */
- status = ds_rm_rf(installroot, rm_rf_err_func, NULL);
- while (status && try_rm_rf_again && busy_retries) {
- PR_snprintf(line, sizeof(line), "Some files or directories in %s are still in use. Will sleep for 30 seconds and try again.",
- installroot);
- ds_show_message(line);
- PR_Sleep(PR_SecondsToInterval(30));
- try_rm_rf_again = 0;
- --busy_retries;
- status = ds_rm_rf(installroot, rm_rf_err_func, NULL);
- }
- if (status) {
- PR_snprintf(line, sizeof(line), "Could not remove %s. Please check log messages and try again.",
- installroot);
- ds_send_error(line, 0);
- }
- }
-#ifdef XP_WIN32
- if (servername) {
- status += ds_remove_reg_key(HKEY_LOCAL_MACHINE, "%s\\%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE,
- DS_NAME_SHORT, DS_VERSION, servername);
-
- /* also try to remove version key in case this is the last instance */
- status += ds_remove_reg_key(HKEY_LOCAL_MACHINE, "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE,
- DS_NAME_SHORT, DS_VERSION);
-
- /* also try to remove product key in case this is the last instance */
- status += ds_remove_reg_key(HKEY_LOCAL_MACHINE, "%s\\%s", KEY_SOFTWARE_NETSCAPE,
- DS_NAME_SHORT);
-
- /* also need to remove service */
- if (!DeleteServer(servername)) {
- status += 1;
- }
-
- /* Remove Event Log Key */
- status += ds_remove_reg_key(HKEY_LOCAL_MACHINE, "%s\\%s\\%s", KEY_SERVICES, KEY_EVENTLOG_APP, servername);
- }
-#endif
-
- if (status == 0) {
- char buf[1024];
- PR_snprintf(buf, sizeof(buf), "Server %s was successfully removed", servername);
- ds_show_message(buf);
- rpt_success("");
- } else {
- char buf[1024];
- PR_snprintf(buf, sizeof(buf), "Could not remove server %s", servername);
- ds_send_error(buf, 0);
- }
-
- return status;
-}
diff --git a/ldap/admin/src/ds_rmdb.c b/ldap/admin/src/ds_rmdb.c
deleted file mode 100644
index 2c6f47e3..00000000
--- a/ldap/admin/src/ds_rmdb.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * Delete backed-up database files.
- *
- * Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "portable.h"
-#include "init_ds_env.h"
-#include <string.h>
-#ifdef XP_UNIX
-#include <unistd.h>
-#endif
-#ifdef XP_WIN32
-#include <direct.h>
-#endif
-#include "nspr.h"
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-
-int main(int argc, char *argv[], char *envp[])
-{
- char *del_file = NULL;
- char **bak_files;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- ds_become_localuser (ds_get_config (DS_REAL_CONFIG));
-
- /*
- * Get value of the "deletefile" variable.
- */
- del_file = ds_get_cgi_var("deletefile");
- if ( (NULL == del_file) || (strlen(del_file) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "deletefile", NULL, NULL );
- return 1;
- }
-
- bak_files = ds_get_file_list( del_file );
- if ( bak_files == NULL ) {
- rpt_err( DS_NO_SUCH_FILE, del_file, NULL, NULL );
- return 1;
- } else {
- int j;
- char buf[ MAXPATHLEN ];
- for ( j = 0; bak_files[ j ] != NULL; j++ ) {
- PR_snprintf( buf, sizeof(buf), "%s/%s", del_file, bak_files[ j ]);
- if ( unlink(buf) != 0 ) {
- rpt_err( DS_CANNOT_DELETE_FILE, buf, NULL, NULL );
- return 1;
- }
- }
- if ( rmdir( del_file ) < 0 ) {
- rpt_err( DS_CANNOT_DELETE_FILE, del_file, NULL, NULL );
- return 1;
- }
- }
- rpt_success("Success! Deleted directory.");
-
- return 0;
-}
diff --git a/ldap/admin/src/ds_snmpctrl.c b/ldap/admin/src/ds_snmpctrl.c
deleted file mode 100644
index 1ac2fea6..00000000
--- a/ldap/admin/src/ds_snmpctrl.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * snmpctrl.c - start/stop/restart LDAP-based SNMP subagent
- *
- * Steve Ross -- 08/12/97
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include "nspr.h"
-
-#if !defined(_WIN32)
-#include <signal.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <stdlib.h>
-#else
-#include <windows.h>
-#endif
-
-#define SUBAGT_PATH "bin/slapd/server"
-#define SUBAGT_NAME "ns-ldapagt"
-
-#define START 1
-#define STOP 2
-#define RESTART 3
-
-#define NSLDAPAGT_PID "NSLDAPAGT.LK"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-int nsldapagt_is_running(void);
-int nsldapagt_shutdown(void);
-int nsldapagt_start(void);
-int nsldapagt_restart(void);
-#ifdef __cplusplus
-}
-#endif
-
-int main(int argc, char *argv[])
-{
- char *action_type = NULL;
- int status = 1;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- action_type = ds_a_get_cgi_var("ACTION", "Missing Command",
- "Need to specify Start, Stop, or Restart");
- if (!action_type)
- return 1;
-
- if (!strcmp(action_type, "START")) {
- status = nsldapagt_start();
- } else if (!strcmp(action_type, "STOP")) {
- status = nsldapagt_shutdown();
- } else if (!strcmp(action_type, "RESTART")) {
- status = nsldapagt_restart();
- } else {
- status = DS_UNKNOWN_SNMP_COMMAND;
- }
-
- if ( !status ) {
- rpt_success("Success!");
- return 0;
- } else {
- rpt_err( status, action_type, NULL, NULL );
- return 1;
- }
-}
-
-#if !defined(_WIN32)
-int
-get_nsldapagt_pid(pid_t *pid)
-{
- char *SLAPD_ROOT;
- char path[PATH_MAX];
- FILE *fp;
-
- *pid = -1;
-
- SLAPD_ROOT = ds_get_install_root();
- PR_snprintf(path, sizeof(path), "%s/logs/%s", SLAPD_ROOT, NSLDAPAGT_PID);
- if (!ds_file_exists(path)) {
- return(-1);
- }
-
- if ((fp = fopen(path, "r")) != (FILE *) NULL) {
- if ((fscanf(fp, "%d\n", (int *) pid)) != -1) {
- (void) fclose(fp);
- return(0);
- }
- }
-
- (void) fclose(fp);
- return(-1);
-}
-#endif
-
-#if defined(_WIN32)
-BOOL isServiceRunning(LPCTSTR szServiceId)
-{
- BOOL bReturn = FALSE;
- DWORD dwError = 0;
- SC_HANDLE schService = NULL;
- SC_HANDLE schSCManager = NULL;
- SERVICE_STATUS lpss;
-
- if((schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)))
- {
- if((schService = OpenService(schSCManager,
- szServiceId,
- SERVICE_ALL_ACCESS)))
- {
-
- bReturn = ControlService(schService, SERVICE_CONTROL_INTERROGATE , &lpss);
-
- if(SERVICE_RUNNING == lpss.dwCurrentState)
- {
- bReturn = TRUE;
- }
-
- CloseServiceHandle(schService);
- }
- dwError = GetLastError();
- CloseServiceHandle(schSCManager);
- }
- return(bReturn);
-}
-#endif
-
-/*
- * This routine returns:
- * 0 if nsldapagt is NOT running
- * 1 if nsldapagt is actually running
- */
-int
-nsldapagt_is_running()
-{
-
-#if defined(_WIN32)
- if (FALSE == isServiceRunning("SNMP") )
- {
- return(0);
- }
-#else
- pid_t pid;
-
- if (get_nsldapagt_pid(&pid) != 0) {
- return(0);
- }
-
- if (kill(pid, 0) == -1) {
- return(0);
- }
-#endif
- return(1);
-}
-
-#if !defined(_WIN32)
-/*
- * This routine returns:
- * 0 if magt is NOT running
- * 1 if magt is actually running
- *
- * The run state is determined whether one can successfully bind to the
- * smux port.
- *
- * this is for UNIX only
- */
-int
-smux_master_is_running()
-{
- struct servent *pse;
- struct protoent *ppe;
- struct sockaddr_in sin;
- int s;
-
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
-
- if ((pse = getservbyname("smux", "tcp"))) {
- sin.sin_port = ntohs(pse->s_port);
- } else {
- sin.sin_port = 199;
- }
-
- if ((ppe = getprotobyname("tcp")) == 0) {
- return(0);
- }
-
- if ((s = socket(AF_INET, SOCK_STREAM, ppe->p_proto)) < 0) {
- return(0);
- }
-
- /* bind expects port number to be in network order
- we should do this for all platforms, not just OSF. */
- sin.sin_port = htons(sin.sin_port);
- if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
- close(s);
- return(1);
- } else {
- }
-
- close(s);
- return(0);
-}
-#endif
-
-int
-nsldapagt_start()
-{
- if (nsldapagt_is_running()) {
- return(0);
- }
-
-#if defined(_WIN32)
-/* NT version -- just try to start the SNMP service */
-/* Bug 612322: redirecting the output to null device */
- system("net start SNMP > nul");
-
-#else
-
- /*
- * Check if smux master agent is running before firing off the subagent!
- */
- if (!smux_master_is_running()) {
- return(-1);
- } else {
- char *NETSITE_ROOT = getenv("NETSITE_ROOT");
- char *SLAPD_ROOT = ds_get_install_root();
- char command[1024];
-
- PR_snprintf(command, sizeof(command), "cd %s/%s; ./%s -d %s", NETSITE_ROOT, SUBAGT_PATH,
- SUBAGT_NAME, SLAPD_ROOT);
-
- (void) system(command);
- sleep(2);
- }
-#endif
-
- if (!nsldapagt_is_running()) {
- return(-1);
- }
-
- return(0);
-}
-
-int
-nsldapagt_shutdown()
-{
- if (!nsldapagt_is_running()) {
- rpt_success("NOT_RUNNING");
- exit(0);
-
- } else {
- int status = -1;
-
-#if defined(_WIN32)
- /* NT version -- just try to stop the SNMP service */
- /* Bug 612322: redirecting the output to null device */
- status = system("net stop SNMP > nul");
-
-#else
- /* UNIX version */
- pid_t pid;
- if (get_nsldapagt_pid(&pid) == 0)
- {
- if (kill(pid, SIGTERM) == 0)
- {
- sleep(2);
- if (!nsldapagt_is_running())
- {
- status = 0;
- }
- }
- }
-#endif
- return(status);
- }
- return(0);
-}
-
-
-int
-nsldapagt_restart()
-{
- int status;
- if ( (status = nsldapagt_shutdown()) != 0 )
- return status;
- else
- return nsldapagt_start();
-}
-
diff --git a/ldap/admin/src/restart.c b/ldap/admin/src/restart.c
deleted file mode 100644
index e45676e7..00000000
--- a/ldap/admin/src/restart.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * restart.c: Stops and the starts up the server.
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-
-#ifdef XP_WIN32
- #define sleep(sec) Sleep(sec)
-#endif
-
-int main(int argc, char *argv[])
-{
- int status = -1;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- if (DS_SERVER_UP == ds_get_updown_status()) {
- status = ds_bring_down_server();
- if(status != DS_SERVER_DOWN) {
- rpt_err( status, "", NULL, NULL );
- return 1;
- }
- }
- status = ds_bring_up_server(1);
- if(status == DS_SERVER_UP) {
- rpt_success("Success! The server has been restarted.");
- return 0;
- } else {
- rpt_err( status, "", NULL, NULL );
- return 1;
- }
-}
diff --git a/ldap/admin/src/shutdown.c b/ldap/admin/src/shutdown.c
deleted file mode 100644
index a1c98a5d..00000000
--- a/ldap/admin/src/shutdown.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * shutdown.c: Kills the server.
- *
- * DS changes: Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- * Mike McCool
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-
-int main(int argc, char *argv[])
-{
- int status = -1;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- status = ds_bring_down_server();
- if(status == DS_SERVER_DOWN) {
- rpt_success("Success! The server has been shut down.");
- return 0;
- } else {
- rpt_err( status, "", NULL, NULL );
- return 1;
- }
-}
-
diff --git a/ldap/admin/src/start.c b/ldap/admin/src/start.c
deleted file mode 100644
index 1765ab0c..00000000
--- a/ldap/admin/src/start.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * start.c: Starts up the server.
- *
- * DS changes: Anil Bhavnani
- * Removed all HTML output for DS 4.0: Rob Weltman
- * Mike McCool
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-
-
-int main(int argc, char *argv[])
-{
- int status = -1;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 0;
-
- status = ds_bring_up_server(1);
- if(status == DS_SERVER_UP) {
- rpt_success("Success! The server has been started.");
- return 0;
- } else {
- rpt_err( status, "", NULL, NULL );
- return 1;
- }
-}
diff --git a/ldap/admin/src/vlvindex.c b/ldap/admin/src/vlvindex.c
deleted file mode 100644
index 6eb8c1a9..00000000
--- a/ldap/admin/src/vlvindex.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * vlvindex.c: Creates a VLV index for a given search
- *
- * Rob Weltman
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "libadminutil/admutil.h"
-#include "dsalib.h"
-#include "init_ds_env.h"
-#include <string.h>
-
-int main(int argc, char *argv[])
-{
- int status;
- char *backendNames = NULL;
- char *attributes = NULL;
- char *tmparg = NULL;
- char **attrList = NULL;
- char **backendList = NULL;
- int nItem = 0;
- char *nextItem = NULL;
- int i=0;
-
- fprintf(stdout, "Content-type: text/html\n\n");
-
- if ( init_ds_env() )
- return 1;
-
- ds_send_status("Creating vlv index ...");
-
- /*
- * Get var's value
- */
- backendNames = ds_get_cgi_var("backendID");
- if ( (NULL == backendNames) || (strlen(backendNames) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "backendID", NULL, NULL );
- return 1;
- }
-
- attributes = ds_get_cgi_var("vlvTags");
- if ( (NULL == attributes) || (strlen(attributes) < 1) ) {
- rpt_err( DS_UNDEFINED_VARIABLE, "vlvTags", NULL, NULL );
- return 1;
- }
-
- tmparg = strdup( attributes );
- nItem = 0;
- for(i=0 ; i < strlen(attributes) ; i++) {
- if ( tmparg[i] == ';' ) nItem++;
- }
- /* Allocate for worst possible case */
- attrList = (char **)malloc(sizeof(*attrList) * (nItem + 2) );
- nItem = 0;
- /* strtok() is not MT safe, but it is okay to call here because this is a command line */
- attrList[nItem++] = strtok( tmparg, ";" );
- do {
- nextItem = strtok( NULL, ";" );
- attrList[nItem++] = nextItem;
- } while( nextItem != NULL );
-
- tmparg = strdup( backendNames );
- nItem = 0;
- for(i=0;i<strlen(tmparg); i++) {
- if ( tmparg[i] == ';' ) nItem++;
- }
- backendList = (char **)malloc(sizeof(*backendList) * nItem + 2);
- nItem = 0;
- backendList[nItem++] = strtok( tmparg, ";" );
- do {
- nextItem = strtok( NULL, ";" );
- backendList[nItem++] = nextItem;
- } while( nextItem != NULL );
-
- status = ds_vlvindex(backendList, attrList);
-
- if ( !status ) {
- rpt_success("Success! The index has been created.");
- status = 0;
- } else {
- rpt_err( status, backendList[0], NULL, NULL );
- status = 1;
- }
-
- return status;
-}