]> arthur.barton.de Git - netatalk.git/commitdiff
Solaris compatibility fix, use putenv() for KRB5_KEYTAB rather than setenv().
authorsamnoble <samnoble>
Fri, 22 Aug 2003 20:41:09 +0000 (20:41 +0000)
committersamnoble <samnoble>
Fri, 22 Aug 2003 20:41:09 +0000 (20:41 +0000)
etc/afpd/afp_options.c

index 9813fe3a87ba0a42ce8f1a25d13c396cf45e8b2e..b3e9290ca71545776e7c7361b3b07b825e907d9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.32 2003-06-09 15:09:19 srittau Exp $
+ * $Id: afp_options.c,v 1.33 2003-08-22 20:41:09 samnoble Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -128,6 +128,8 @@ void afp_options_free(struct afp_options *opt,
         free(opt->k5service);
     if (opt->k5realm && (opt->k5realm != save->k5realm))
         free(opt->k5realm);
+    if (opt->k5keytab && (opt->k5keytab != save->k5keytab))
+       free(opt->k5keytab);
 }
 
 /* initialize options */
@@ -395,8 +397,14 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->k5service = opt;
     if ((c = getoption(buf, "-k5realm")) && (opt = strdup(c)))
         options->k5realm = opt;
-    if ((c = getoption(buf, "-k5keytab")))
-        setenv( "KRB5_KTNAME", c, 1 );
+    if ((c = getoption(buf, "-k5keytab"))) {
+       if ( NULL == (options->k5keytab = (char *)malloc(sizeof(char) * (strlen(c)+14)) )) {
+           LOG(log_error, logtype_afpd, "malloc failed");
+           exit(-1);
+       }
+       snprintf(options->k5keytab, strlen(c) + 14, "KRB5_KTNAME=%s",c);
+       putenv(options->k5keytab);
+    }
     if ((c = getoption(buf, "-authprintdir")) && (opt = strdup(c)))
         options->authprintdir = opt;
     if ((c = getoption(buf, "-uampath")) && (opt = strdup(c)))