use esetenv

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9089 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-10-02 05:06:04 +00:00
parent 80b8795b5b
commit 3e00ddf50d
13 changed files with 30 additions and 47 deletions

View File

@@ -83,7 +83,7 @@ main(int argc, char **argv)
f = mkstemp (tf + 5); f = mkstemp (tf + 5);
close (f); close (f);
unlink (tf + 5); unlink (tf + 5);
setenv("KRB5CCNAME", tf, 1); esetenv("KRB5CCNAME", tf, 1);
#endif #endif
#ifdef KRB4 #ifdef KRB4
@@ -91,7 +91,7 @@ main(int argc, char **argv)
f = mkstemp (tf); f = mkstemp (tf);
close (f); close (f);
unlink (tf); unlink (tf);
setenv("KRBTKFILE", tf, 1); esetenv("KRBTKFILE", tf, 1);
#endif #endif
i = 0; i = 0;

View File

@@ -221,7 +221,7 @@ int k5dcesession(luid, pname, tgt, ppag, tflags)
*ppag = prev_pag; *ppag = prev_pag;
strcpy(ccname+38,prev_name); strcpy(ccname+38,prev_name);
setenv("KRB5CCNAME",ccname,1); esetenv("KRB5CCNAME",ccname,1);
return(0); return(0);
} }
@@ -315,7 +315,7 @@ int k5dcegettgt(pcache, ccname, pname, tgt)
* either. * either.
*/ */
setenv("KRB5CCNAME",ccname,1); esetenv("KRB5CCNAME",ccname,1);
cache = NULL; cache = NULL;
*tgt = NULL; *tgt = NULL;
@@ -449,7 +449,7 @@ int k5dcecon(luid, luser, pname)
return(0); /* but OK to continue */ return(0); /* but OK to continue */
} }
setenv("KRB5CCNAME","",1); esetenv("KRB5CCNAME","",1);
#define TKT_ACCEPTABLE (TKT_FLG_FORWARDABLE | TKT_FLG_PROXIABLE \ #define TKT_ACCEPTABLE (TKT_FLG_FORWARDABLE | TKT_FLG_PROXIABLE \
| TKT_FLG_MAY_POSTDATE | TKT_FLG_RENEWABLE | TKT_FLG_HW_AUTH \ | TKT_FLG_MAY_POSTDATE | TKT_FLG_RENEWABLE | TKT_FLG_HW_AUTH \
@@ -538,7 +538,7 @@ int k5dcecreate(luid, luser, pname, krbtgt)
int lst; int lst;
dce_error_string_t err_string; dce_error_string_t err_string;
setenv("KRB5CCNAME","",1); /* make sure it not misused */ esetenv("KRB5CCNAME","",1); /* make sure it not misused */
uid = getuid(); uid = getuid();
DEEDEBUG2("uid=%d\n",uid); DEEDEBUG2("uid=%d\n",uid);

View File

@@ -140,7 +140,7 @@ main(argc, argv)
sprintf (ccname, sprintf (ccname,
"FILE:/opt/dcelocal/var/security/creds/dcecred_%8.8x", "FILE:/opt/dcelocal/var/security/creds/dcecred_%8.8x",
pag); pag);
setenv("KRB5CCNAME",ccname,1); esetenv("KRB5CCNAME",ccname,1);
execl("/bin/csh","csh",0); execl("/bin/csh","csh",0);
} }
else { else {

View File

@@ -100,7 +100,7 @@ gss_userok(void *app_data, char *username)
krb5_afslog(gssapi_krb5_context, ccache, 0, 0); krb5_afslog(gssapi_krb5_context, ccache, 0, 0);
} }
#endif #endif
setenv ("KRB5CCNAME", ticketfile, 1); esetenv ("KRB5CCNAME", ticketfile, 1);
fail: fail:
if (ccache) if (ccache)

View File

@@ -696,7 +696,7 @@ main(int argc, char **argv)
} }
#if defined(DCE) && defined(AIX) #if defined(DCE) && defined(AIX)
setenv("AUTHSTATE", "DCE", 1); esetenv("AUTHSTATE", "DCE", 1);
#endif #endif
/* XXX should we care about environment on the command line? */ /* XXX should we care about environment on the command line? */

View File

@@ -685,7 +685,7 @@ doit (int do_kerberos, int check_rhosts)
} }
#if defined(DCE) && defined(AIX) #if defined(DCE) && defined(AIX)
setenv("AUTHSTATE", "DCE", 1); esetenv("AUTHSTATE", "DCE", 1);
#endif #endif
pwd = getpwnam (server_user); pwd = getpwnam (server_user);
@@ -734,7 +734,7 @@ doit (int do_kerberos, int check_rhosts)
#if defined(DCE) #if defined(DCE)
if (kerberos_status) { if (kerberos_status) {
setenv("KRB5CCNAME", tkfile, 1); esetenv("KRB5CCNAME", tkfile, 1);
dfspag = krb5_dfs_pag(context, kerberos_status, user_ticket->client, server_user); dfspag = krb5_dfs_pag(context, kerberos_status, user_ticket->client, server_user);
} }
#endif #endif

View File

@@ -206,7 +206,7 @@ krb5_start_session(void)
asprintf(&cc_name, "%s:%s", krb5_cc_get_type(context, ccache2), asprintf(&cc_name, "%s:%s", krb5_cc_get_type(context, ccache2),
krb5_cc_get_name(context, ccache2)); krb5_cc_get_name(context, ccache2));
setenv("KRB5CCNAME", cc_name, 1); esetenv("KRB5CCNAME", cc_name, 1);
/* we want to export this even if we don't directly support KRB4 */ /* we want to export this even if we don't directly support KRB4 */
{ {
@@ -220,7 +220,7 @@ krb5_start_session(void)
fd = mkstemp(tkfile); fd = mkstemp(tkfile);
if(fd >= 0) { if(fd >= 0) {
close(fd); close(fd);
setenv("KRBTKFILE", tkfile, 1); esetenv("KRBTKFILE", tkfile, 1);
} }
} }
@@ -376,16 +376,16 @@ main(int argc, char **argv)
if (environ == NULL) if (environ == NULL)
err (1, "malloc"); err (1, "malloc");
environ[0] = NULL; environ[0] = NULL;
setenv ("PATH", _PATH_DEFPATH, 1); esetenv ("PATH", _PATH_DEFPATH, 1);
if (t) if (t)
setenv ("TERM", t, 1); esetenv ("TERM", t, 1);
if (chdir (su_info->pw_dir) < 0) if (chdir (su_info->pw_dir) < 0)
errx (1, "no directory"); errx (1, "no directory");
} }
if (full_login || su_info->pw_uid) if (full_login || su_info->pw_uid)
setenv ("USER", su_info->pw_name, 1); esetenv ("USER", su_info->pw_name, 1);
setenv("HOME", su_info->pw_dir, 1); esetenv("HOME", su_info->pw_dir, 1);
setenv("SHELL", shell, 1); esetenv("SHELL", shell, 1);
} }
{ {

View File

@@ -331,7 +331,7 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
"%s%u", "%s%u",
TKT_ROOT, TKT_ROOT,
(unsigned)pw->pw_uid); (unsigned)pw->pw_uid);
setenv("KRBTKFILE", ts, 1); esetenv("KRBTKFILE", ts, 1);
if (pw->pw_uid == 0) if (pw->pw_uid == 0)
syslog(LOG_INFO|LOG_AUTH, syslog(LOG_INFO|LOG_AUTH,

View File

@@ -277,7 +277,6 @@ kerberos5_is(Authenticator *ap, unsigned char *data, int cnt)
krb5_data outbuf; krb5_data outbuf;
krb5_keyblock *key_block; krb5_keyblock *key_block;
char *name; char *name;
krb5_principal server;
int zero = 0; int zero = 0;
if (cnt-- < 1) if (cnt-- < 1)
@@ -312,29 +311,13 @@ kerberos5_is(Authenticator *ap, unsigned char *data, int cnt)
return; return;
} }
ret = krb5_sock_to_principal (context,
0,
"host",
KRB5_NT_SRV_HST,
&server);
if (ret) {
Data(ap, KRB_REJECT, "krb5_sock_to_principal failed", -1);
auth_finished(ap, AUTH_REJECT);
if (auth_debug_mode)
printf("Kerberos V5: "
"krb5_sock_to_principal failed (%s)\r\n",
krb5_get_err_text(context, ret));
return;
}
ret = krb5_rd_req(context, ret = krb5_rd_req(context,
&auth_context, &auth_context,
&auth, &auth,
server, NULL,
NULL, NULL,
NULL, NULL,
&ticket); &ticket);
krb5_free_principal (context, server);
if (ret) { if (ret) {
char *errbuf; char *errbuf;
@@ -477,7 +460,7 @@ kerberos5_is(Authenticator *ap, unsigned char *data, int cnt)
} }
#if defined(DCE) #if defined(DCE)
setenv("KRB5CCNAME", ccname, 1); esetenv("KRB5CCNAME", ccname, 1);
#endif #endif
ret = krb5_rd_cred (context, ret = krb5_rd_cred (context,
auth_context, auth_context,
@@ -772,9 +755,9 @@ kerberos5_dfspag(void)
{ {
if (dfsk5ok) { if (dfsk5ok) {
dfspag = krb5_dfs_pag(context, dfsfwd, ticket->client, dfspag = krb5_dfs_pag(context, dfsfwd, ticket->client,
UserNameRequested); UserNameRequested);
} }
} }
#endif #endif
#endif /* KRB5 */ #endif /* KRB5 */

View File

@@ -1016,7 +1016,7 @@ suboption(void)
return; return;
settimer(xdisplocsubopt); settimer(xdisplocsubopt);
subpointer[SB_LEN()] = '\0'; subpointer[SB_LEN()] = '\0';
setenv("DISPLAY", (char *)subpointer, 1); esetenv("DISPLAY", (char *)subpointer, 1);
break; break;
} /* end of case TELOPT_XDISPLOC */ } /* end of case TELOPT_XDISPLOC */
@@ -1183,7 +1183,7 @@ suboption(void)
case ENV_USERVAR: case ENV_USERVAR:
*cp = '\0'; *cp = '\0';
if (valp) if (valp)
setenv(varp, valp, 1); esetenv(varp, valp, 1);
else else
unsetenv(varp); unsetenv(varp);
cp = varp = (char *)subpointer; cp = varp = (char *)subpointer;
@@ -1202,7 +1202,7 @@ suboption(void)
} }
*cp = '\0'; *cp = '\0';
if (valp) if (valp)
setenv(varp, valp, 1); esetenv(varp, valp, 1);
else else
unsetenv(varp); unsetenv(varp);
break; break;

View File

@@ -738,7 +738,7 @@ Please contact your net administrator");
*/ */
*user_name = 0; *user_name = 0;
level = getterminaltype(user_name, sizeof(user_name)); level = getterminaltype(user_name, sizeof(user_name));
setenv("TERM", terminaltype ? terminaltype : "network", 1); esetenv("TERM", terminaltype ? terminaltype : "network", 1);
#ifdef _SC_CRAY_SECURE_SYS #ifdef _SC_CRAY_SECURE_SYS
if (secflag) { if (secflag) {

View File

@@ -286,10 +286,10 @@ afs_gettktstring (void)
} }
} }
#ifdef KRB5 #ifdef KRB5
setenv("KRB5CCNAME",krb5ccname,1); esetenv("KRB5CCNAME",krb5ccname,1);
#endif #endif
#ifdef KRB4 #ifdef KRB4
setenv("KRBTKFILE",krbtkfile,1); esetenv("KRBTKFILE",krbtkfile,1);
return krbtkfile; return krbtkfile;
#else #else
return ""; return "";

View File

@@ -330,7 +330,7 @@ int krb5_dfs_pag(context, flag, principal, luser)
close(fd[0]); close(fd[0]);
if (j > 0) { if (j > 0) {
newccname[j] = '\0'; newccname[j] = '\0';
setenv("KRB5CCNAME",newccname,1); esetenv("KRB5CCNAME",newccname,1);
sscanf(&newccname[j-8],"%8x",&new_pag); sscanf(&newccname[j-8],"%8x",&new_pag);
if (new_pag && strncmp("FILE:/opt/dcelocal/var/security/creds/dcecred_", newccname, 46) == 0) { if (new_pag && strncmp("FILE:/opt/dcelocal/var/security/creds/dcecred_", newccname, 46) == 0) {
if((pag = krb5_dfs_newpag(new_pag)) != -2) { if((pag = krb5_dfs_newpag(new_pag)) != -2) {