mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
From jon@symas.com - patches for consistent use of directory separators
in pathnames.
This commit is contained in:
parent
a19a5d8c15
commit
e6d6faf3c9
@ -122,7 +122,7 @@ main( int argc, char **argv )
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (myname = strrchr( argv[0], '/' )) == NULL )
|
||||
if ( (myname = strrchr( argv[0], *LDAP_DIRSEP )) == NULL )
|
||||
myname = strdup( argv[0] );
|
||||
else
|
||||
myname = strdup( myname + 1 );
|
||||
|
@ -163,7 +163,7 @@ main ( int argc, char **argv )
|
||||
int numto, ngroups, numerr, nargs;
|
||||
int i, j;
|
||||
|
||||
if ( (myname = strrchr( argv[0], '/' )) == NULL )
|
||||
if ( (myname = strrchr( argv[0], *LDAP_DIRSEP )) == NULL )
|
||||
myname = strdup( argv[0] );
|
||||
else
|
||||
myname = strdup( myname + 1 );
|
||||
|
@ -191,7 +191,7 @@ main ( int argc, char **argv )
|
||||
int i, j;
|
||||
char *conffile = NULL;
|
||||
|
||||
if ( (myname = strrchr( argv[0], '/' )) == NULL )
|
||||
if ( (myname = strrchr( argv[0], *LDAP_DIRSEP )) == NULL )
|
||||
myname = strdup( argv[0] );
|
||||
else
|
||||
myname = strdup( myname + 1 );
|
||||
|
@ -590,7 +590,7 @@ main( int argc, char **argv )
|
||||
}
|
||||
#else
|
||||
fprintf( stderr, "%s: not compiled with SASL support\n",
|
||||
argv[0] );
|
||||
prog );
|
||||
return( EXIT_FAILURE );
|
||||
#endif
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ main( int argc, char **argv )
|
||||
}
|
||||
#else
|
||||
fprintf( stderr, "%s: not compiled with SASL support\n",
|
||||
argv[0] );
|
||||
prog );
|
||||
return( EXIT_FAILURE );
|
||||
#endif
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ main(int argc, char **argv)
|
||||
default:
|
||||
fprintf( stderr, "%s: unrecognized option -%c\n",
|
||||
prog, optopt );
|
||||
usage( argv[0] );
|
||||
usage( prog );
|
||||
return( EXIT_FAILURE );
|
||||
}
|
||||
}
|
||||
@ -512,7 +512,7 @@ main(int argc, char **argv)
|
||||
} else if ( argc - optind != 0 ) {
|
||||
fprintf( stderr, "%s: invalid number of arguments (%d), "
|
||||
"only two allowed\n", prog, argc-optind );
|
||||
usage( argv[0] );
|
||||
usage( prog );
|
||||
return( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -627,7 +627,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
#else
|
||||
fprintf( stderr, "%s: not compiled with SASL support\n",
|
||||
argv[0] );
|
||||
prog );
|
||||
return( EXIT_FAILURE );
|
||||
#endif
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ main( int argc, char *argv[] )
|
||||
default:
|
||||
fprintf( stderr, "%s: unrecognized option -%c\n",
|
||||
prog, optopt );
|
||||
usage (argv[0]);
|
||||
usage (prog);
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ main( int argc, char *argv[] )
|
||||
}
|
||||
|
||||
if( argc - optind > 1 ) {
|
||||
usage( argv[0] );
|
||||
usage( prog );
|
||||
} else if ( argc - optind == 1 ) {
|
||||
user = strdup( argv[optind] );
|
||||
} else {
|
||||
@ -636,7 +636,7 @@ main( int argc, char *argv[] )
|
||||
}
|
||||
#else
|
||||
fprintf( stderr, "%s: not compiled with SASL support\n",
|
||||
argv[0] );
|
||||
prog );
|
||||
return( EXIT_FAILURE );
|
||||
#endif
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ load_editor( void )
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MKSTEMP
|
||||
sprintf(entry_temp_file, "/tmp/udXXXXXX");
|
||||
strcpy(entry_temp_file, LDAP_TMPDIR LDAP_DIRSEP "udXXXXXX");
|
||||
|
||||
tmpfd = mkstemp(entry_temp_file);
|
||||
|
||||
@ -192,7 +192,7 @@ load_editor( void )
|
||||
if (verbose) {
|
||||
char *p;
|
||||
|
||||
if (( p = strrchr( editor, '/' )) == NULL ) {
|
||||
if (( p = strrchr( editor, *LDAP_DIRSEP )) == NULL ) {
|
||||
p = editor;
|
||||
} else {
|
||||
++p;
|
||||
|
@ -263,11 +263,11 @@ static void openldap_ldap_init_w_userconf(const char *file)
|
||||
/* we assume UNIX path syntax is used... */
|
||||
|
||||
/* try ~/file */
|
||||
sprintf(path, "%s/%s", home, file);
|
||||
sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
|
||||
openldap_ldap_init_w_conf(path, 1);
|
||||
|
||||
/* try ~/.file */
|
||||
sprintf(path, "%s/.%s", home, file);
|
||||
sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
|
||||
openldap_ldap_init_w_conf(path, 1);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,8 @@ ldif_fetch_url(
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( *p != *LDAP_DIRSEP ) {
|
||||
/* we don't check for LDAP_DIRSEP since URLs should contain '/' */
|
||||
if( *p != '/' ) {
|
||||
/* skip over false root */
|
||||
p++;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
/* $Id: ucdata.c,v 1.4 2001/01/02 18:46:20 mleisher Exp $" */
|
||||
|
||||
#include "portable.h"
|
||||
#include "ldap_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -36,12 +37,6 @@
|
||||
|
||||
#include "ucdata.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define UC_DIRSEP '\\'
|
||||
#else
|
||||
#define UC_DIRSEP '/'
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Miscellaneous types, data, and support functions.
|
||||
@ -89,7 +84,7 @@ _ucopenfile(char *paths, char *filename, char *mode)
|
||||
pp = path;
|
||||
while (*dp && *dp != ':')
|
||||
*pp++ = *dp++;
|
||||
*pp++ = UC_DIRSEP;
|
||||
*pp++ = *LDAP_DIRSEP;
|
||||
|
||||
fp = filename;
|
||||
while (*fp)
|
||||
|
@ -23,6 +23,7 @@
|
||||
/* $Id: ucgendat.c,v 1.4 2001/01/02 18:46:20 mleisher Exp $" */
|
||||
|
||||
#include "portable.h"
|
||||
#include "ldap_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -1181,7 +1182,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the ctype.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/ctype.dat", opath);
|
||||
sprintf(path, "%s%sctype.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1252,7 +1253,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the case.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/case.dat", opath);
|
||||
sprintf(path, "%s%scase.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1307,7 +1308,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the comp.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/comp.dat", opath);
|
||||
sprintf(path, "%s%scomp.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1345,7 +1346,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the decomp.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/decomp.dat", opath);
|
||||
sprintf(path, "%s%sdecomp.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1405,7 +1406,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the cmbcl.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/cmbcl.dat", opath);
|
||||
sprintf(path, "%s%scmbcl.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1443,7 +1444,7 @@ write_cdata(char *opath)
|
||||
/*
|
||||
* Open the num.dat file.
|
||||
*/
|
||||
sprintf(path, "%s/num.dat", opath);
|
||||
sprintf(path, "%s%snum.dat", opath, LDAP_DIRSEP);
|
||||
if ((out = fopen(path, "wb")) == 0)
|
||||
return;
|
||||
|
||||
@ -1496,7 +1497,7 @@ main(int argc, char *argv[])
|
||||
FILE *in;
|
||||
char *prog, *opath;
|
||||
|
||||
if ((prog = strrchr(argv[0], '/')) != 0)
|
||||
if ((prog = strrchr(argv[0], *LDAP_DIRSEP)) != 0)
|
||||
prog++;
|
||||
else
|
||||
prog = argv[0];
|
||||
|
Loading…
Reference in New Issue
Block a user