[5150] in Athena Bugs
patches to 7.0F xlogin
daemon@ATHENA.MIT.EDU (vanharen@ATHENA.MIT.EDU)
Mon Jun 11 13:26:49 1990
From: vanharen@ATHENA.MIT.EDU
Date: Mon, 11 Jun 90 13:26:03 -0400
To: bugs@ATHENA.MIT.EDU
I had to make these changes to xlogin in order to get it to compile and
work correctly when attempting to build it without the -DATHENA flag
passed in. Without the -DATHENA flag, you are compiling without HESIOD,
ZEPHYR, KERBEROS, etc.
In "verify.c", a few necessary #ifdef's were missed, and a variable that
should've been outside an "#ifdef KERBEROS" was inside.
Those are the only changes that were necessary to make it compile --
however, some environment variables (USER, HOME, SHELL) were not getting
set correctly with KERBEROS undef'ed. In order to get it to work
correctly, I had to add one or 2 lines.
The rest of the changes are simply comment symbols around comments on
#endif lines. Some compilers will accept "#endif TEST", for example,
but some won't, so I changed all the occurences I could find to
"#endif /* TEST */".
Please let me know if these changes seem acceptable/reasonable.
Thanks,
-Chris.
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/console.c ./console.c
*** /source/athena/etc.athena/xdm/console.c Fri May 11 13:47:28 1990
--- ./console.c Mon Jun 11 12:43:38 1990
***************
*** 29,35 ****
#if ( !defined(lint) && !defined(SABER))
static char *rcsid_console_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/etc.athena/xdm/RCS/console.c,v 7.4 90/05/11 13:47:10 epeisach Exp $";
! #endif lint
#include <stdio.h>
#include <X11/Xos.h>
--- 29,35 ----
#if ( !defined(lint) && !defined(SABER))
static char *rcsid_console_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/etc.athena/xdm/RCS/console.c,v 7.4 90/05/11 13:47:10 epeisach Exp $";
! #endif /* lint */
#include <stdio.h>
#include <X11/Xos.h>
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/console.h ./console.h
*** /source/athena/etc.athena/xdm/console.h Fri May 11 13:41:23 1990
--- ./console.h Mon Jun 11 12:43:41 1990
***************
*** 70,73 ****
void UltrixReadConsole();
#endif
! #endif _CONSOLE
--- 70,73 ----
void UltrixReadConsole();
#endif
! #endif /* _CONSOLE */
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/greet.c ./greet.c
*** /source/athena/etc.athena/xdm/greet.c Mon Apr 30 16:58:40 1990
--- ./greet.c Mon Jun 11 12:43:42 1990
***************
*** 72,78 ****
void CreateFancyButtons();
! #endif ADD_ONS
void
SetupGreet(session,greet)
--- 72,78 ----
void CreateFancyButtons();
! #endif /* ADD_ONS */
void
SetupGreet(session,greet)
***************
*** 115,121 ****
#ifdef DEBUG
Debug("checking resources...");
! #endif DEBUG
/* quit if for some reason we cannot access the resources for xlogin */
sprintf(name, "%s.resLoaded", XLOGIN_NAME);
--- 115,121 ----
#ifdef DEBUG
Debug("checking resources...");
! #endif /* DEBUG */
/* quit if for some reason we cannot access the resources for xlogin */
sprintf(name, "%s.resLoaded", XLOGIN_NAME);
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/resource.c ./resource.c
*** /source/athena/etc.athena/xdm/resource.c Mon Apr 30 16:59:16 1990
--- ./resource.c Mon Jun 11 12:43:44 1990
***************
*** 128,134 ****
#ifdef DEBUG
int i;
char debug_buf[BUFSIZ];
! #endif DEBUG
#ifdef DEBUG
for (i = 0; i < *argc; i++) {
Debug("command line arguements.");
--- 128,134 ----
#ifdef DEBUG
int i;
char debug_buf[BUFSIZ];
! #endif /* DEBUG */
#ifdef DEBUG
for (i = 0; i < *argc; i++) {
Debug("command line arguements.");
***************
*** 135,141 ****
sprintf(debug_buf, "argv[%d] = %s.", i, argv[i]);
Debug(debug_buf);
}
! #endif DEBUG
s->grabTimeout = 5; /* temporary */
s->consoleLog = "/tmp/xlogin.log"; /*temporary*/
--- 135,141 ----
sprintf(debug_buf, "argv[%d] = %s.", i, argv[i]);
Debug(debug_buf);
}
! #endif /* DEBUG */
s->grabTimeout = 5; /* temporary */
s->consoleLog = "/tmp/xlogin.log"; /*temporary*/
***************
*** 200,206 ****
#ifdef DEBUG
sprintf(debug_buf, "Config file is: %s.", config_file);
Debug(debug_buf);
! #endif DEBUG
if ( (XL_config = XrmGetFileDatabase(config_file)) == NULL ) {
/* here we abort under the assumption that if -config option
--- 200,206 ----
#ifdef DEBUG
sprintf(debug_buf, "Config file is: %s.", config_file);
Debug(debug_buf);
! #endif /* DEBUG */
if ( (XL_config = XrmGetFileDatabase(config_file)) == NULL ) {
/* here we abort under the assumption that if -config option
***************
*** 227,233 ****
sprintf(class, "%s.Config", XLOGIN_CLASS);
if (!XrmGetResource(defaultDB, name, class, &junk, &value_ret))
Debug("Nothing there.");
! #endif DEBUG
LoadConfigInfo(s,defaultDB);
}
--- 227,233 ----
sprintf(class, "%s.Config", XLOGIN_CLASS);
if (!XrmGetResource(defaultDB, name, class, &junk, &value_ret))
Debug("Nothing there.");
! #endif /* DEBUG */
LoadConfigInfo(s,defaultDB);
}
***************
*** 285,291 ****
sprintf(temp_str, "Resource %s found : name - %s.",
*addr, xlogin_config[i].resource_name);
Debug(temp_str);
! #endif DEBUG
}
else {
*addr = xlogin_config[i].default_addr;
--- 285,291 ----
sprintf(temp_str, "Resource %s found : name - %s.",
*addr, xlogin_config[i].resource_name);
Debug(temp_str);
! #endif /* DEBUG */
}
else {
*addr = xlogin_config[i].default_addr;
***************
*** 293,299 ****
sprintf(temp_str, "name %s has no match: default - %s.",
xlogin_config[i].resource_name, *addr);
Debug(temp_str);
! #endif DEBUG
}
}
}
--- 293,299 ----
sprintf(temp_str, "name %s has no match: default - %s.",
xlogin_config[i].resource_name, *addr);
Debug(temp_str);
! #endif /* DEBUG */
}
}
}
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/setup.c ./setup.c
*** /source/athena/etc.athena/xdm/setup.c Mon Apr 30 17:00:57 1990
--- ./setup.c Mon Jun 11 12:43:45 1990
***************
*** 229,235 ****
dup2(ttyconsole,2);
if (ttyconsole != 0)
close(ttyconsole);
! #endif ultrix
signal(SIGHUP,SIG_DFL);
}
--- 229,235 ----
dup2(ttyconsole,2);
if (ttyconsole != 0)
close(ttyconsole);
! #endif /* ultrix */
signal(SIGHUP,SIG_DFL);
}
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/verify.c ./verify.c
*** /source/athena/etc.athena/xdm/verify.c Fri May 4 18:05:36 1990
--- ./verify.c Mon Jun 11 12:43:47 1990
***************
*** 54,60 ****
#ifdef KERBEROS
#include <krb.h>
#include <netdb.h>
! #endif KERBEROS
typedef char Boolean;
--- 54,60 ----
#ifdef KERBEROS
#include <krb.h>
#include <netdb.h>
! #endif /* KERBEROS */
typedef char Boolean;
***************
*** 70,76 ****
char * InitKerberos();
void InsertPasswdEntry(), DestroyTickets();
struct passwd *insertedp = NULL;
! #endif KERBEROS
#ifdef ATTACH
void FindOrAttachHomedir(), DetachHomedir();
--- 70,76 ----
char * InitKerberos();
void InsertPasswdEntry(), DestroyTickets();
struct passwd *insertedp = NULL;
! #endif /* KERBEROS */
#ifdef ATTACH
void FindOrAttachHomedir(), DetachHomedir();
***************
*** 78,84 ****
#define ATTACH_COMMAND ("/bin/athena/attach")
#define DETACH_COMMAND ("/bin/athena/detach")
! #endif ATTACH
#define QUOTA_COMMAND "/usr/ucb/quota"
#define GET_MESSAGE "/bin/athena/get_message"
--- 78,84 ----
#define ATTACH_COMMAND ("/bin/athena/attach")
#define DETACH_COMMAND ("/bin/athena/detach")
! #endif /* ATTACH */
#define QUOTA_COMMAND "/usr/ucb/quota"
#define GET_MESSAGE "/bin/athena/get_message"
***************
*** 89,99 ****
#ifndef TRUE
#define TRUE 1
! #endif TRUE
#ifndef FALSE
#define FALSE 0
! #endif FALSE
#define DEFAULT_UID 200
#define DEFAULT_GID 101 /* group mit. */
--- 89,99 ----
#ifndef TRUE
#define TRUE 1
! #endif /* TRUE */
#ifndef FALSE
#define FALSE 0
! #endif /* FALSE */
#define DEFAULT_UID 200
#define DEFAULT_GID 101 /* group mit. */
***************
*** 110,116 ****
#define KRB_ENVIRON ("KRBTKFILE") /* Kerberos ticket file. */
#ifdef ZEPHYR
#define WG_ENVIRON ("WGFILE") /* Kerberos ticket file. */
! #endif ZEPHYR
#define NOCREATE ("/etc/nocreate") /* do not try to create new users. */
static int nocreate; /* Will hold if noreate exists */
#define NOATTACH ("/etc/noattach")/* do not try to attach homedir. */
--- 110,116 ----
#define KRB_ENVIRON ("KRBTKFILE") /* Kerberos ticket file. */
#ifdef ZEPHYR
#define WG_ENVIRON ("WGFILE") /* Kerberos ticket file. */
! #endif /* ZEPHYR */
#define NOCREATE ("/etc/nocreate") /* do not try to create new users. */
static int nocreate; /* Will hold if noreate exists */
#define NOATTACH ("/etc/noattach")/* do not try to attach homedir. */
***************
*** 124,130 ****
static Boolean global_tmp_home;
static Boolean local_ok = FALSE; /* Password okay when checked against local
passwd. */
! #endif KERBEROS
extern int errno; /* error return values. */
--- 124,130 ----
static Boolean global_tmp_home;
static Boolean local_ok = FALSE; /* Password okay when checked against local
passwd. */
! #endif /* KERBEROS */
extern int errno; /* error return values. */
***************
*** 132,138 ****
static Boolean in_passwd_file; /* True if the user is in the password
file, whether or not the user's password
in authenticated. */
! #endif HESIOD
void AbortHandler()
{
--- 132,138 ----
static Boolean in_passwd_file; /* True if the user is in the password
file, whether or not the user's password
in authenticated. */
! #endif /* HESIOD */
void AbortHandler()
{
***************
*** 171,176 ****
--- 171,177 ----
struct passwd *p;
char *crypt ();
char error_buf[BUFSIZ];
+ FILE *nlfd;
#ifdef KERBEROS
char * krb_tkt_file = NULL; /* kerberos ticket file, if kerberos failed
then this is NULL. */
***************
*** 180,186 ****
long salt;
char saltc[2];
int i, c;
- FILE *nlfd;
Boolean exit = FALSE;
/* If we are going to do hesiod lookups on the person, we will need to save
his encrypted password for inclusion in the password file.
--- 181,186 ----
***************
*** 200,207 ****
strcpy(encrypt,crypt(user->password, saltc));
insertedp = NULL;
attachedp = NULL;
! #endif HESIOD
! #endif KERBEROS
Debug("Verifying...");
--- 200,207 ----
strcpy(encrypt,crypt(user->password, saltc));
insertedp = NULL;
attachedp = NULL;
! #endif /* HESIOD */
! #endif /* KERBEROS */
Debug("Verifying...");
***************
*** 274,286 ****
}
p->pw_passwd = encrypt;
}
! #else HESIOD
if ( p == NULL ) {
sprintf(error_buf, "Could not get password entry for user %s.",
user->name);
exit = TRUE;
}
! #endif HESIOD
if ( !exit && (krb_tkt_file != NULL) ) {
if ((chown(krb_tkt_file, p->pw_uid, p->pw_gid) != 0) &&
--- 274,286 ----
}
p->pw_passwd = encrypt;
}
! #else /* HESIOD */
if ( p == NULL ) {
sprintf(error_buf, "Could not get password entry for user %s.",
user->name);
exit = TRUE;
}
! #endif /* HESIOD */
if ( !exit && (krb_tkt_file != NULL) ) {
if ((chown(krb_tkt_file, p->pw_uid, p->pw_gid) != 0) &&
***************
*** 297,303 ****
return(FALSE);
}
}
! #endif KERBEROS
/*
* p must be a good entry now.
--- 297,303 ----
return(FALSE);
}
}
! #endif /* KERBEROS */
/*
* p must be a good entry now.
***************
*** 310,316 ****
--- 310,318 ----
while (fgets(error_buf, BUFSIZ, nlfd) != NULL)
LoginMessage(error_buf);
fclose(nlfd);
+ #ifdef KERBEROS
DestroyTickets();
+ #endif /* KERBEROS */
sprintf(error_buf,"%s file exists - logins disabled\n", NOLOGIN);
LoginError(error_buf);
return(FALSE);
***************
*** 325,331 ****
--- 327,335 ----
"ROOT LOGIN REFUSED ON %s", user->ttydev);
sprintf(error_buf,
"ROOT LOGIN REFUSED ON %s", user->ttydev);
+ #ifdef KERBEROS
DestroyTickets();
+ #endif /* KERBEROS */
LoginError(error_buf); /* Should never return but... */
return(FALSE);
}
***************
*** 339,345 ****
Debug("Running quota program....");
Run_Quota(p);
}
! #endif ATTACH
{
char buf[1024];
sprintf(buf, "%s/%s", p->pw_dir, HUSHLOGIN);
--- 343,349 ----
Debug("Running quota program....");
Run_Quota(p);
}
! #endif /* ATTACH */
{
char buf[1024];
sprintf(buf, "%s/%s", p->pw_dir, HUSHLOGIN);
***************
*** 358,364 ****
#else
verify->gid = p->pw_gid;
#endif
! #ifdef KERBEROS
if ( (verify->environ = FindEnvirons( p, krb_tkt_file)) == NULL) {
if (krb_tkt_file != NULL) {
--- 362,370 ----
#else
verify->gid = p->pw_gid;
#endif
! #ifndef KERBEROS
! if ( (verify->environ = FindEnvirons( p, NULL)) == NULL) {
! #else /* KERBEROS */
if ( (verify->environ = FindEnvirons( p, krb_tkt_file)) == NULL) {
if (krb_tkt_file != NULL) {
***************
*** 365,374 ****
DestroyTickets();
free(krb_tkt_file);
}
return(FALSE);
}
- #endif KERBEROS
/* should return False ifndef KERBEROS ?*/
#ifdef KERBEROS
--- 371,380 ----
DestroyTickets();
free(krb_tkt_file);
}
+ #endif /* KERBEROS */
return(FALSE);
}
/* should return False ifndef KERBEROS ?*/
#ifdef KERBEROS
***************
*** 380,388 ****
InsertPasswdEntry(p);
insertedp = p;
}
! #endif HESIOD
! #endif KERBEROS
#ifdef ROOTLOG
if ( p->pw_uid == ROOT ) {
--- 386,394 ----
InsertPasswdEntry(p);
insertedp = p;
}
! #endif /* HESIOD */
! #endif /* KERBEROS */
#ifdef ROOTLOG
if ( p->pw_uid == ROOT ) {
***************
*** 391,397 ****
sprintf(error_buf, "Root has logged into %s.", user->ttydev);
SystemNotice(error_buf);
}
! #endif ROOTLOG
Debug("verify succeeded.");
return(TRUE);
--- 397,403 ----
sprintf(error_buf, "Root has logged into %s.", user->ttydev);
SystemNotice(error_buf);
}
! #endif /* ROOTLOG */
Debug("verify succeeded.");
return(TRUE);
***************
*** 442,448 ****
if (global_tmp_home) {
environment[count] = "TMPHOME=1"; count++;
}
! #endif KERBEROS
#ifdef ZEPHYR
wgfile = "/tmp/wg.XXXXXX";
--- 448,454 ----
if (global_tmp_home) {
environment[count] = "TMPHOME=1"; count++;
}
! #endif /* KERBEROS */
#ifdef ZEPHYR
wgfile = "/tmp/wg.XXXXXX";
***************
*** 449,455 ****
mktemp(wgfile);
sprintf(temp_buf, "%s=%s", WG_ENVIRON, wgfile); /* wgfile file. */
environment[count] = stralloc(temp_buf); count++;
! #endif ZEPHYR
environment[count] = NULL; count++; /* NULL terminate this sucker. */
--- 455,461 ----
mktemp(wgfile);
sprintf(temp_buf, "%s=%s", WG_ENVIRON, wgfile); /* wgfile file. */
environment[count] = stralloc(temp_buf); count++;
! #endif /* ZEPHYR */
environment[count] = NULL; count++; /* NULL terminate this sucker. */
***************
*** 525,531 ****
#ifdef HESIOD
if (! nocreate)
GetGroups(name);
! #endif HESIOD
ngroups = 0;
group_list[ngroups++] = gid; /* set group id. */
--- 531,537 ----
#ifdef HESIOD
if (! nocreate)
GetGroups(name);
! #endif /* HESIOD */
ngroups = 0;
group_list[ngroups++] = gid; /* set group id. */
***************
*** 549,555 ****
endgrent();
return(ngroups);
}
! #endif NGROUPS
/* Below here everything is ifdef'd, on one of: KERBEROS, ATTACH, HESIOD. */
--- 555,561 ----
endgrent();
return(ngroups);
}
! #endif /* NGROUPS */
/* Below here everything is ifdef'd, on one of: KERBEROS, ATTACH, HESIOD. */
***************
*** 697,703 ****
}
}
! #endif HESIOD
/* Below here everything is ifdef'd, on one of: KERBEROS, ATTACH. */
--- 703,709 ----
}
}
! #endif /* HESIOD */
/* Below here everything is ifdef'd, on one of: KERBEROS, ATTACH. */
***************
*** 884,890 ****
} else return(1);
}
! #endif KERBEROS
/* Function Name: Run_Quota
--- 890,896 ----
} else return(1);
}
! #endif /* KERBEROS */
/* Function Name: Run_Quota
***************
*** 1214,1220 ****
register int count;
#ifdef DEBUG
char debug_buf[BUFSIZ];
! #endif DEBUG
if ( (dp = opendir(dir)) == NULL)
return(FALSE);
--- 1220,1226 ----
register int count;
#ifdef DEBUG
char debug_buf[BUFSIZ];
! #endif /* DEBUG */
if ( (dp = opendir(dir)) == NULL)
return(FALSE);
***************
*** 1231,1237 ****
}
else
Debug("temp is now NULL.");
! #endif DEBUG
}
closedir(dp);
--- 1237,1243 ----
}
else
Debug("temp is now NULL.");
! #endif /* DEBUG */
}
closedir(dp);
***************
*** 1278,1284 ****
close(fh);
return(FALSE);
}
! #endif ATTACH
#ifdef KERBEROS
/*
--- 1284,1290 ----
close(fh);
return(FALSE);
}
! #endif /* ATTACH */
#ifdef KERBEROS
/*
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/verify.h ./verify.h
*** /source/athena/etc.athena/xdm/verify.h Fri Oct 20 10:15:10 1989
--- ./verify.h Mon Jun 11 12:43:49 1990
***************
*** 28,38 ****
#ifndef TRUE
#define TRUE 1
! #endif TRUE
#ifndef FALSE
#define FALSE 0
! #endif FALSE
#ifndef DEFAULT
#define DEFAULT 0
--- 28,38 ----
#ifndef TRUE
#define TRUE 1
! #endif /* TRUE */
#ifndef FALSE
#define FALSE 0
! #endif /* FALSE */
#ifndef DEFAULT
#define DEFAULT 0
***************
*** 49,55 ****
#define ATTACH 1 /* using attach. */
#define ZEPHYR 1 /* using zephyr */
! #endif ATHENA
#ifdef KERBEROS
#ifdef ZEPHYR
--- 49,55 ----
#define ATTACH 1 /* using attach. */
#define ZEPHYR 1 /* using zephyr */
! #endif /* ATHENA */
#ifdef KERBEROS
#ifdef ZEPHYR
***************
*** 59,65 ****
#endif
#else
#define MAXENVIRONS 6
! #endif KERBEROS
struct user_info {
char name[NAME_LEN + 1];
--- 59,65 ----
#endif
#else
#define MAXENVIRONS 6
! #endif /* KERBEROS */
struct user_info {
char name[NAME_LEN + 1];
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/xlogin.c ./xlogin.c
*** /source/athena/etc.athena/xdm/xlogin.c Thu May 24 16:49:17 1990
--- ./xlogin.c Mon Jun 11 12:43:52 1990
***************
*** 232,238 ****
close(2);
}
}
! #endif DEBUG
SetupGreet(&theSession,&greet);
--- 232,238 ----
close(2);
}
}
! #endif /* DEBUG */
SetupGreet(&theSession,&greet);
==============================================================================
diff -rbc /source/athena/etc.athena/xdm/xlogin.h ./xlogin.h
*** /source/athena/etc.athena/xdm/xlogin.h Fri Oct 20 10:14:42 1989
--- ./xlogin.h Mon Jun 11 12:43:53 1990
***************
*** 76,86 ****
#ifndef TRUE
#define TRUE 1
! #endif TRUE
#ifndef FALSE
#define FALSE 0
! #endif FALSE
#define UNIXTM ("unix")
--- 76,86 ----
#ifndef TRUE
#define TRUE 1
! #endif /* TRUE */
#ifndef FALSE
#define FALSE 0
! #endif /* FALSE */
#define UNIXTM ("unix")
***************
*** 159,162 ****
#define XLOGIN_NAME ("xlogin")
#define XLOGIN_CLASS ("XLogin")
! #endif _xdm_h_ /* Do not add anything after this line. */
--- 159,162 ----
#define XLOGIN_NAME ("xlogin")
#define XLOGIN_CLASS ("XLogin")
! #endif /* _xlogin_h_ */ /* Do not add anything after this line. */