Define and use a path separator string

A colon can't be used to separate paths on Windows since they are used
in drive sepecification.  Define a macro that can be used as a path
separator string.  On Windows, this is defined as ";".  It is a ":"
everywhere else.
This commit is contained in:
Asanka C. Herath
2010-11-12 11:34:21 -05:00
parent 0ea880bdeb
commit d3582b56c6
4 changed files with 18 additions and 11 deletions

View File

@@ -99,9 +99,12 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
@FEATURE_DEFS@ @FEATURE_DEFS@
/* Define is backslashes act as path delimiters */ /* Define is backslashes act as path name delimiters */
#define BACKSLASH_PATH_DELIM 1 #define BACKSLASH_PATH_DELIM 1
/* Path separator character */
#define PATH_SEP ";"
/* Define if you want to use DES encryption in telnet. */ /* Define if you want to use DES encryption in telnet. */
#define DES_ENCRYPTION 1 #define DES_ENCRYPTION 1

View File

@@ -37,18 +37,18 @@
KRB5_LIB_VARIABLE const char *krb5_config_file = KRB5_LIB_VARIABLE const char *krb5_config_file =
#ifdef __APPLE__ #ifdef __APPLE__
"~/Library/Preferences/com.apple.Kerberos.plist:" "~/Library/Preferences/com.apple.Kerberos.plist" PATH_SEP
"/Library/Preferences/com.apple.Kerberos.plist:" "/Library/Preferences/com.apple.Kerberos.plist" PATH_SEP
"~/Library/Preferences/edu.mit.Kerberos:" "~/Library/Preferences/edu.mit.Kerberos" PATH_SEP
"/Library/Preferences/edu.mit.Kerberos:" "/Library/Preferences/edu.mit.Kerberos" PATH_SEP
#endif /* __APPLE__ */ #endif /* __APPLE__ */
"~/.krb5/config:" "~/.krb5/config" PATH_SEP
SYSCONFDIR "/krb5.conf" SYSCONFDIR "/krb5.conf"
#ifdef _WIN32 #ifdef _WIN32
":%{COMMON_APPDATA}/Kerberos/krb5.conf" PATH_SEP "%{COMMON_APPDATA}/Kerberos/krb5.conf"
":%{WINDOWS}/krb5.ini" PATH_SEP "%{WINDOWS}/krb5.ini"
#else #else
":/etc/krb5.conf" PATH_SEP "/etc/krb5.conf"
#endif #endif
; ;

View File

@@ -673,7 +673,7 @@ krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp)
while(1) { while(1) {
ssize_t l; ssize_t l;
q = p; q = p;
l = strsep_copy(&q, ":", NULL, 0); l = strsep_copy(&q, PATH_SEP, NULL, 0);
if(l == -1) if(l == -1)
break; break;
fn = malloc(l + 1); fn = malloc(l + 1);
@@ -681,7 +681,7 @@ krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp)
krb5_free_config_files(pp); krb5_free_config_files(pp);
return ENOMEM; return ENOMEM;
} }
(void)strsep_copy(&p, ":", fn, l + 1); (void)strsep_copy(&p, PATH_SEP, fn, l + 1);
ret = add_file(&pp, &len, fn); ret = add_file(&pp, &len, fn);
if (ret) { if (ret) {
krb5_free_config_files(pp); krb5_free_config_files(pp);

View File

@@ -188,6 +188,10 @@ struct _krb5_krb_auth_data;
#define ALLOC(X, N) (X) = calloc((N), sizeof(*(X))) #define ALLOC(X, N) (X) = calloc((N), sizeof(*(X)))
#define ALLOC_SEQ(X, N) do { (X)->len = (N); ALLOC((X)->val, (N)); } while(0) #define ALLOC_SEQ(X, N) do { (X)->len = (N); ALLOC((X)->val, (N)); } while(0)
#ifndef PATH_SEP
#define PATH_SEP ":"
#endif
/* should this be public? */ /* should this be public? */
#define KEYTAB_DEFAULT "FILE:" SYSCONFDIR "/krb5.keytab" #define KEYTAB_DEFAULT "FILE:" SYSCONFDIR "/krb5.keytab"
#define KEYTAB_DEFAULT_MODIFY "FILE:" SYSCONFDIR "/krb5.keytab" #define KEYTAB_DEFAULT_MODIFY "FILE:" SYSCONFDIR "/krb5.keytab"