[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kde2: kdm wish (fwd)
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-06-25 21:15:50
[Download RAW message or body]

I am no kdm expert so I can't review the patch, but as a user, I've
been waiting for this for a very long time. I've even been meaning
to have a look at implementing it...

How will one choose that option ? I guess it will have to be added
as a checkbox into the kcontrol module [kdmconfig] ?

I hope you can convince Steffen to add it, it's really a great feature :-)

On Sun, Jun 25, 2000 at 10:46:45PM +0200, Oswald Buddenhagen wrote:
> hi all,
> 
> please have a look at it.
> 
> [] denote comments from me:
> 
> ---------- Forwarded message ----------
> Date: Sun, 25 Jun 2000 22:21:34 +0200 (CEST)
> From: Steffen Hansen <hansen@kde.org>
> To: Oswald Buddenhagen <ob6@inf.tu-dresden.de>
> Subject: Re: kde2: kdm wish
> 
> On Sun, 25 Jun 2000, Oswald Buddenhagen wrote:
> 
> > hi,
> > 
> > would be nice, if you would incorporate my auto-login extension into the
> > upstream kdm. the patch is available from
> > http://www.inf.tu-dresden.de/~ob6/unix/xautolog.html
> > give it a try! ;-)
> 
> I know that such a feature might be nice for a non-networked single user
> [exactly :))]
> PC, but for now i'm waaaay to paranoid to but this in kdm :)
> [this is exactly the expected reaction ;)]
> 
> But i'm not saying that this cant change! Try posting your patch to
> kde-devel, and get some people to look through it. A potentially dangerous
> patch like this needs more than 4 eyes of approval before being accepted. 
> [yes. perfectly right. i already posted this to debian-devel (i created a 
> generic xdm patch, too. in fact the kdm patch should/could work for the
> older xdm version kdm is based on).]
> 
> greetings,
> -- 
> Steffen Hansen                            
> email: hansen@dexel.dk, hansen@kde.org, stefh@huleboer.dk
> 
> "The obvious mathematical breakthrough would be development of an easy
> way to factor large prime numbers." 
> 	Bill Gates, The Road Ahead, Viking Penguin (1995)
> 
> ---------- End forwarded message ----------
> 
> i hope, that i get some positive feedback ... :-)))
> 
> regards
> 
> -- 
> Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
> --
> If Windows is the answer, I want the problems back!

Content-Description: the questionable patch
> diff -ur kdm-org/dm.c kdm/dm.c
> --- kdm-org/dm.c	Wed Jan  6 03:11:49 1999
> +++ kdm/dm.c	Thu Jun 22 20:00:56 2000
> @@ -85,6 +85,8 @@
>  extern FILE    *fdopen();
>  #endif
>  
> +extern void puthist(struct display *d, int wasm);
> +
>  static void	RescanServers ();
>  static void	ScanServers ();
>  int		Rescan;
> @@ -462,11 +464,13 @@
>  	    switch (waitVal (status)) {
>  	    case UNMANAGE_DISPLAY:
>  		Debug ("Display exited with UNMANAGE_DISPLAY\n");
> +		puthist(d, 0);
>  		StopDisplay (d);
>  		break;
>  	    case OBEYSESS_DISPLAY:
>  		d->startTries = 0;
>  		Debug ("Display exited with OBEYSESS_DISPLAY\n");
> +		puthist(d, 1);
>  		if (d->displayType.lifetime != Permanent ||
>  		    d->status == zombie)
>  		    StopDisplay (d);
> @@ -506,6 +510,7 @@
>  	    case RESERVER_DISPLAY:
>  		d->startTries = 0;
>  		Debug ("Display exited with RESERVER_DISPLAY\n");
> +		puthist(d, 0);
>  		if (d->displayType.origin == FromXDMCP || d->status == zombie)
>  		    StopDisplay(d);
>  		else
> @@ -515,6 +520,7 @@
>  	    case waitCompose (SIGKILL,0,0):
>  		d->startTries = 0;
>  		Debug ("Display exited on SIGTERM/SIGKILL\n");
> +		puthist(d, 0);
>  		if (d->displayType.origin == FromXDMCP || d->status == zombie)
>  		    StopDisplay(d);
>  		else
> @@ -527,6 +533,7 @@
>   		 * XDMCP will restart the session if the display
>  		 * requests it
>  		 */
> +		puthist(d, 1);
>  		if (d->displayType.origin == FromXDMCP || d->status == zombie)
>  		    StopDisplay(d);
>  		else
> diff -ur kdm-org/dm.h kdm/dm.h
> --- kdm-org/dm.h	Wed Sep 30 23:19:55 1998
> +++ kdm/dm.h	Tue Jun 20 22:50:17 2000
> @@ -245,6 +245,12 @@
>  
>  	int		version;	/* to keep dynamic greeter clued in */
>  	/* add new fields only after here.  And preferably at the end. */
> +
> +	/* belongs to session management resources */
> +	int		wasManaged;	/* auto-logon only at first attempt. */
> +	char		*autoUser;	/* user to log in automatically. */
> +	char		*autoPass;	/* his password. only for krb5 & sec_rpc */
> +	char		*autoString;	/* xsession arguments. */
>  };
>  
>  #ifdef XDMCP
> diff -ur kdm-org/dpylist.c kdm/dpylist.c
> --- kdm-org/dpylist.c	Wed Sep 30 23:19:56 1998
> +++ kdm/dpylist.c	Thu Jun 22 19:39:33 2000
> @@ -39,7 +39,44 @@
>  
>  # include "dm.h"
>  
> +struct disphist {
> +  struct disphist *next;
> +  char *name;
> +  time_t crash;
> +};
> +
>  static struct display	*displays;
> +static struct disphist	*disphist;
> +
> +struct disphist *findhist(char *name)
> +{
> +  struct disphist *hstent;
> +
> +  for(hstent=disphist; hstent; hstent=hstent->next)
> +    if(!strcmp(hstent->name, name))
> +      return hstent;
> +  return 0;
> +}
> +
> +void puthist(struct display *d, int wasm)
> +{
> +  struct disphist *hstent=findhist(d->name);
> +  if(!hstent) {
> +    Debug("adding display %s to history (WasMangaged=%d)\n",d->name,wasm);
> +    hstent=malloc(sizeof (struct disphist));
> +    if(!hstent) return;
> +    hstent->name = malloc ((unsigned) (strlen (d->name) + 1));
> +    if (!hstent->name) { free (hstent);	return; }
> +    strcpy (hstent->name, d->name);
> +    hstent->next=disphist; disphist=hstent;
> +  } else
> +    Debug("refreshing history for display %s (WasMangaged=%d)\n",d->name,wasm);
> +  d->wasManaged=wasm;
> +  if(wasm)
> +    time(&(hstent->crash));
> +  else
> +    hstent->crash=0;
> +}
>  
>  int AnyDisplaysLeft ()
>  {
> @@ -182,6 +219,9 @@
>  	    IfFree (d->from);
>  	    XdmcpDisposeARRAY8 (&d->clientAddr);
>  #endif
> +	    IfFree (d->autoUser);
> +	    IfFree (d->autoPass);
> +	    IfFree (d->autoString);
>  	    free ((char *) d);
>  	    break;
>  	}
> @@ -270,6 +310,14 @@
>      d->clientAddr.length = 0;
>      d->connectionType = 0;
>  #endif
> +    {
> +      struct disphist *hstent=findhist(d->name);
> +      d->wasManaged = hstent && hstent->crash > time(0)-10;
> +      Debug("WasManaged = %d\n",d->wasManaged);
> +    }
> +    d->autoUser = NULL;
> +    d->autoPass = NULL;
> +    d->autoString = NULL;
>      d->version = 1;		/* registered with X Consortium */
>      displays = d;
>      return d;
> diff -ur kdm-org/resource.c kdm/resource.c
> --- kdm-org/resource.c	Thu Jan 28 15:10:02 1999
> +++ kdm/resource.c	Thu Jun 22 19:39:41 2000
> @@ -341,6 +341,12 @@
>  				DEF_USER_AUTH_DIR},
>  {"chooser",	"Chooser",	DM_STRING,	boffset(chooser),
>  				DEF_CHOOSER},
> +{"autoUser",    "AutoUser",	DM_STRING,	boffset(autoUser),
> +				""},
> +{"autoPass",    "AutoPass",	DM_STRING,	boffset(autoPass),
> +				""},
> +{"autoString",  "AutoString",	DM_STRING,	boffset(autoString),
> +				""}
>  };
>  
>  # define NUM_SESSION_RESOURCES	(sizeof sessionResources/\
> @@ -379,16 +385,15 @@
>  
>      Debug ("%s/%s value %*.*s\n", name, class, len, len, string);
>  
> -    if (valueType == DM_STRING && *valuep)
> -    {
> -	if (strlen (*valuep) == len && !strncmp (*valuep, string, len))
> -	    return;
> -	else
> -	    free (*valuep);
> -    }
> -
>      switch (valueType) {
>      case DM_STRING:
> +        if (*valuep)
> +        {
> +	    if (strlen (*valuep) == len && !strncmp (*valuep, string, len))
> +		return;
> +	    else
> +		free (*valuep);
> +        }
>  	new_string = malloc ((unsigned) (len+1));
>  	if (!new_string) {
>  		LogOutOfMem ("GetResource");
> diff -ur kdm-org/session.c kdm/session.c
> --- kdm-org/session.c	Fri Aug 20 20:35:10 1999
> +++ kdm/session.c	Fri Jun 23 00:09:40 2000
> @@ -391,6 +391,30 @@
>      /*NOTREACHED*/
>  }
>  
> +int Verify( struct display*, struct greet_info*, struct verify_info*);
> +
> +int
> +AutoLogon (d)
> +struct display	*d;
> +{
> +    static char password[20];
> +
> +    if(d->wasManaged || d->autoUser[0]=='\0')
> +	return 0;
> +    greet.name=d->autoUser;
> +    if(d->autoPass[0]=='\0')
> +      greet.password=0;
> +    else {
> +      greet.password=password; strcpy(password, d->autoPass);
> +    }
> +    greet.string=strlen(d->autoString)?d->autoString:"default";
> +    if(!Verify(d, &greet, &verify))
> +	return 0;
> +    if (source (verify.systemEnviron, d->startup) != 0)
> +    	SessionExit (d, OBEYSESS_DISPLAY, FALSE);
> +    return 1;
> +}
> +
>  extern void SetTitle();
>  
>  void
> @@ -400,7 +424,6 @@
>       /* volatile added /stefh */
>      volatile int       	pid = 0/*, code*/;
>      Display		*dpy;
> -    greet_user_rtn	greet_stat; 
>      static GreetUserProc greet_user_proc = NULL;
>      /*void		*greet_lib_handle;*/
>  
> @@ -432,9 +455,9 @@
>       * These version numbers are registered with the X Consortium. */
>      verify.version = 1;
>      greet.version = 1;
> -    greet_stat = (*greet_user_proc)(d, &dpy, &verify, &greet, &dlfuncs);
>  
> -    if (greet_stat == Greet_Success)
> +    if (AutoLogon(d) ||
> +	(*greet_user_proc)(d, &dpy, &verify, &greet, &dlfuncs) == Greet_Success)
>      {
>  	clientPid = 0;
>  	if (!Setjmp (abortSession)) {
> @@ -799,6 +822,9 @@
>  	 */
>  #ifdef SECURE_RPC
>  	/* do like "keylogin" program */
> +	if(!passwd)
> +	    LogError("Warning: no password for NIS provided.\n");
> +	else
>  	{
>  	    char    netname[MAXNETNAMELEN+1], secretkey[HEXKEYBYTES+1];
>  	    int	    nameret, keyret;
> @@ -853,6 +879,9 @@
>  #endif
>  #ifdef K5AUTH
>  	/* do like "kinit" program */
> +	if(!passwd)
> +	    LogError("Warning: no password for Kerberos5 provided.\n");
> +	else
>  	{
>  	    int i, j;
>  	    int result;
> @@ -880,7 +909,7 @@
>  	    }
>  	}
>  #endif /* K5AUTH */
> -	bzero(passwd, strlen(passwd));
> +	if(passwd) bzero(passwd, strlen(passwd));
>  	SetUserAuthorization (d, verify);
>  	home = getEnv (verify->userEnviron, "HOME");
>  	if (home)
> @@ -902,13 +931,13 @@
>  	execute (failsafeArgv, verify->userEnviron);
>  	exit (1);
>      case -1:
> -	bzero(passwd, strlen(passwd));
> +	if(passwd) bzero(passwd, strlen(passwd));
>  	Debug ("StartSession, fork failed\n");
>  	LogError ("can't start session on \"%s\", fork failed, errno=%d\n",
>  		  d->name, errno);
>  	return 0;
>      default:
> -	bzero(passwd, strlen(passwd));
> +	if(passwd) bzero(passwd, strlen(passwd));
>  	Debug ("StartSession, fork succeeded %d\n", pid);
>  	*pidp = pid;
>  	return 1;
> diff -ur kdm-org/util.c kdm/util.c
> --- kdm-org/util.c	Wed Sep 30 23:20:16 1998
> +++ kdm/util.c	Mon Jun 19 14:35:38 2000
> @@ -252,6 +252,7 @@
>  
>  void CleanUpChild ()
>  {
> +    if(!debugLevel) {
>  /*
>  #if defined(SYSV) || defined(SVR4)
>  #if !(defined(SVR4) && defined(i386))
> @@ -270,6 +271,7 @@
>  /*
>  #endif
>  #endif*/
> +    }
>  #ifdef SIGCHLD
>  	(void) Signal (SIGCHLD, SIG_DFL);
>  #endif
> diff -ur kdm-org/verify.c kdm/verify.c
> --- kdm-org/verify.c	Fri Aug 20 20:35:10 1999
> +++ kdm/verify.c	Thu Jun 22 20:30:02 2000
> @@ -237,10 +237,12 @@
>  	p = getpwnam (greet->name);
>  	if (!p || strlen (greet->name) == 0) {
>  		Debug ("getpwnam() failed.\n");
> -		bzero(greet->password, strlen(greet->password));
> +		if(greet->password)
> +			bzero(greet->password, strlen(greet->password));
>  		return 0;
>  	}
>  #ifndef USE_PAM
> +    if(greet->password) {
>  #ifdef USESHADOW
>  	sp = getspnam(greet->name);
>  	if (sp != NULL) {
> @@ -261,6 +263,7 @@
>  		bzero(greet->password, strlen(greet->password));
>  		return 0;
>  	}
> +    }
>  #else /* USE_PAM */
>         #define PAM_BAIL \
>  	  if (pam_error != PAM_SUCCESS) { \
> @@ -274,8 +277,10 @@
>         PAM_BAIL;
>         pam_error = pam_set_item(pamh, PAM_TTY, d->name);
>         PAM_BAIL;
> -       pam_error = pam_authenticate(pamh, 0);
> -       PAM_BAIL;
> +       if(greet->password) {
> +           pam_error = pam_authenticate(pamh, 0);
> +           PAM_BAIL;
> +       }
>         pam_error = pam_acct_mgmt(pamh, 0);
>         /* really should do password changing, but it doesn't fit well */
>         PAM_BAIL;


-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic