Pass Chat Wif Signals

Benjamin Kuit bj at mcs.uts.edu.au
Sun Mar 7 08:13:52 GMT 1999


I've just gained an understanding on my problems with password sync,
especially configuring password chat.

My frustration was due to signal handling in the passwd chatting
procedures.

In most of the scenarios that I've encounted, at the time password
syncing is attempted, the SIG_CLD signal is caught by lib/signal.c:sig_cld.

So when a successful 'chat' ends, the call to 'sys_waitpid()' is made,
to grab the return status of the password program, however from the
experiments I've looked at, sig_cld grabs the status first, so the 
child is gone, and so the sys_waitpid call in chgpasswd:chat_with_program
returns -1, giving the impression that the program quitted without
mummy's knowledge/permission.

This may be a race condition, but I get the feeling that sys_waitpid
wont ever get the signal because at the time it is still caught by
sig_cld.

I've been trying this fix out
~~~
--- samba/source/smbd/chgpasswd.c.orig	Sun Mar  7 18:47:04 1999
+++ samba/source/smbd/chgpasswd.c	Sun Mar  7 19:01:59 1999
@@ -317,6 +317,7 @@
 
   /* we now have a pty */
   if (pid > 0){			/* This is the parent process */
+    CatchSignal(SIGCLD, SIG_DFL);
     if ((chstat = talktochild(master, chatsequence)) == False) {
       DEBUG(3,("Child failed to change password: %s\n",name));
       kill(pid, SIGKILL); /* be sure to end this process */
@@ -327,6 +328,7 @@
       close(master);
       return(False);
     }
+    CatchChild();
 
     close(master);
~~~

On another note, would it be a nifty idea to add another sub/var to
the passwd chat sequence (along with %u, %o, %n)? like %c, being
the unix-crypt of %n, random salt of course.
 
ciao

Bj

+-------------------------------+--------------------------------------+
|      Benjamin (Bj) Kuit       |  Faculty Of Mathematical             |
|      Systems Programmer       |          and Computing Sciences.     |
|      Phone: 02 9514 1841      |  University of Technology, Sydney    |
|      Mobile: 0412 182 972     |  bj at mcs.uts.edu.au                   |
+-------------------------------+--------------------------------------+


More information about the samba-technical mailing list