]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/args.c
don't leak matchedDN
[openldap] / servers / slurpd / args.c
index 380deeab19040980bcdf5ca296a2f2dc96b1175d..4faaadab552c0869a9dcb73c6ee852fc6d49274e 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
 #include <ac/unistd.h>
 
 #include <ldap.h>
+#include <lutil.h>
 
 #include "slurp.h"
 #include "globals.h"
@@ -74,11 +75,7 @@ doargs(
     int                i;
     int                rflag = 0;
 
-    if ( (g->myname = strrchr( argv[0], LDAP_DIRSEP[0] )) == NULL ) {
-       g->myname = strdup( argv[0] );
-    } else {
-       g->myname = strdup( g->myname + 1 );
-    }
+    g->myname = strdup( lutil_progname( "slurpd", argc, argv ));
 
     while ( (i = getopt( argc, argv, "d:f:n:or:t:V" )) != EOF ) {
        switch ( i ) {
@@ -120,6 +117,7 @@ doargs(
 #endif /* LDAP_DEBUG */
            break;
        case 'f':       /* slapd config file */
+           LUTIL_SLASHPATH( optarg );
            g->slapd_configfile = strdup( optarg );
            break;
        case 'n':       /* NT service name */
@@ -130,13 +128,15 @@ doargs(
            g->one_shot_mode = 1;
            break;
        case 'r':       /* slapd replog file */
+           LUTIL_SLASHPATH( optarg );
                snprintf( g->slapd_replogfile, sizeof g->slapd_replogfile,
                        "%s", optarg );
            rflag++;
            break;
        case 't': {     /* dir to use for our copies of replogs */
                size_t sz;
-           g->slurpd_rdir = (char *)malloc (sz = (strlen(optarg) + sizeof("/replica")));
+           LUTIL_SLASHPATH( optarg );
+           g->slurpd_rdir = (char *)malloc (sz = (strlen(optarg) + sizeof(LDAP_DIRSEP "replica")));
            snprintf(g->slurpd_rdir, sz,
                        "%s" LDAP_DIRSEP "replica", optarg);
            } break;