mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 23:40:13 +00:00
aklog: strlen(NULL) doesn't work
strlen(filepath) when !filepath isnt going to work very well. i believe this to be the intent of the author of the original patch. Change-Id: Ib78c5a189b6980223946aff9cf027419127c35bd Reviewed-on: http://gerrit.openafs.org/5328 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
def00ae8ba
commit
c3e82ee98b
@ -1475,19 +1475,15 @@ main(int argc, char *argv[])
|
||||
#if defined(KRB5_PROG_ETYPE_NOSUPP) && !(defined(HAVE_KRB5_ENCTYPE_ENABLE) || defined(HAVE_KRB5_ALLOW_WEAK_CRYPTO))
|
||||
{
|
||||
char *filepath = NULL, *newpath = NULL;
|
||||
filepath = getenv("KRB5_CONFIG");
|
||||
if (!filepath) {
|
||||
int slen;
|
||||
#ifndef AFS_DARWIN_ENV
|
||||
slen = strlen(filepath)+strlen(":/etc/krb5.conf")+1;
|
||||
newpath = malloc(slen);
|
||||
snprintf(newpath, slen, "%s:/etc/krb5.conf", filepath);
|
||||
char *defaultpath = "/etc/krb5.conf";
|
||||
#else
|
||||
slen = strlen("~/Library/Preferences/edu.mit.Kerberos:/Library/Preferences/edu.mit.Kerberos:")+strlen(AFSDIR_CLIENT_ETC_DIRPATH)+strlen("/krb5-weak.conf")+1;
|
||||
newpath = malloc(slen);
|
||||
snprintf(newpath, slen, "~/Library/Preferences/edu.mit.Kerberos:/Library/Preferences/edu.mit.Kerberos:%s/krb5-weak.conf", AFSDIR_CLIENT_ETC_DIRPATH);
|
||||
char *defaultpath = "~/Library/Preferences/edu.mit.Kerberos:/Library/Preferences/edu.mit.Kerberos";
|
||||
#endif
|
||||
}
|
||||
filepath = getenv("KRB5_CONFIG");
|
||||
asprintf(&newpath, "%s:%s/krb5-weak.conf",
|
||||
filepath ? filepath : defaultpath,
|
||||
AFSDIR_CLIENT_ETC_DIRPATH);
|
||||
setenv("KRB5_CONFIG", newpath, 1);
|
||||
#endif
|
||||
krb5_init_context(&context);
|
||||
|
Loading…
Reference in New Issue
Block a user