]> git.sur5r.net Git - openldap/commitdiff
Sync with HEAD
authorKurt Zeilenga <kurt@openldap.org>
Thu, 18 Mar 2004 04:01:25 +0000 (04:01 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 18 Mar 2004 04:01:25 +0000 (04:01 +0000)
servers/slapd/slapdn.c [new file with mode: 0644]
servers/slapd/slaptest.c [new file with mode: 0644]

diff --git a/servers/slapd/slapdn.c b/servers/slapd/slapdn.c
new file mode 100644 (file)
index 0000000..3db6e0b
--- /dev/null
@@ -0,0 +1,80 @@
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2004 The OpenLDAP Foundation.
+ * Portions Copyright 2004 Pierangelo Masarati.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
+#include <lber.h>
+#include <ldif.h>
+#include <lutil.h>
+
+#include "slapcommon.h"
+
+int
+slapdn( int argc, char **argv )
+{
+       int                     rc = EXIT_SUCCESS;
+       const char              *progname = "slapdn";
+
+#ifdef NEW_LOGGING
+       lutil_log_initialize( argc, argv );
+#endif
+       slap_tool_init( progname, SLAPDN, argc, argv );
+
+       argv = &argv[ optind ];
+       argc -= optind;
+
+       for ( ; argc--; argv++ ) {
+               struct berval   dn, pdn, ndn;
+
+               dn.bv_val = argv[ 0 ];
+               dn.bv_len = strlen( argv[ 0 ] );
+
+               rc = dnPrettyNormal( NULL, &dn,
+                                       &pdn, &ndn, NULL );
+               if ( rc != LDAP_SUCCESS ) {
+                       fprintf( stderr, "DN: <%s> check failed %d (%s)\n",
+                                       dn.bv_val, rc,
+                                       ldap_err2string( rc ) );
+                       rc = 1;
+                       
+               } else {
+                       fprintf( stderr, "DN: <%s> check succeeded\n"
+                                       "normalized: <%s>\n"
+                                       "pretty:     <%s>\n",
+                                       dn.bv_val,
+                                       ndn.bv_val, pdn.bv_val );
+                       ch_free( ndn.bv_val );
+                       ch_free( pdn.bv_val );
+                       rc = 0;
+               }
+       }
+       
+       slap_tool_destroy();
+
+       return rc;
+}
diff --git a/servers/slapd/slaptest.c b/servers/slapd/slaptest.c
new file mode 100644 (file)
index 0000000..7a20dfd
--- /dev/null
@@ -0,0 +1,53 @@
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2004 The OpenLDAP Foundation.
+ * Portions Copyright 2004 Pierangelo Masarati.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
+#include <lber.h>
+#include <ldif.h>
+#include <lutil.h>
+
+#include "slapcommon.h"
+
+int
+slaptest( int argc, char **argv )
+{
+       int                     rc = EXIT_SUCCESS;
+       const char              *progname = "slaptest";
+
+#ifdef NEW_LOGGING
+       lutil_log_initialize( argc, argv );
+#endif
+       slap_tool_init( progname, SLAPTEST, argc, argv );
+
+       fprintf( stderr, "config file testing succeeded\n");
+
+       slap_tool_destroy();
+
+       return rc;
+}