home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / linux / 20518 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  3.6 KB

  1. Xref: sparky comp.os.linux:20518 comp.os.linux.announce:44
  2. Newsgroups: comp.os.linux,comp.os.linux.announce
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!batcomputer!sanjuan!pmacdona
  4. From: sanjuan!pmacdona@sol.UVic.CA (Peter MacDonald)
  5. Subject: SLS warning + Xlock shadow password patches.
  6. Message-ID: <1992Dec15.165810.14231@tc.cornell.edu>
  7. Originator: mdw@db.TC.Cornell.EDU
  8. Keywords: SLS xlock patch shadow passwd
  9. Sender: news@tc.cornell.edu
  10. Nntp-Posting-Host: db.tc.cornell.edu
  11. Organization: University of Victoria, Victoria, BC, CANADA
  12. Date: Tue, 15 Dec 1992 16:58:10 GMT
  13. Approved: linux-announce@tc.cornell.edu (Matt Welsh)
  14. Lines: 137
  15.  
  16. Oh damn.  I didn't bother trying the .99 kernel from floppy.
  17. So don't download it until tomorrow evening.  I will put in
  18. Linus's two line patch.
  19.  
  20. Also, here is the patch to get Xlock working again under SLS
  21. with shadow password support.   You have to add -DSHADOW_PWD
  22. to the makefile, and "xlock" must now be setuid root.
  23.  
  24. Peter
  25. -----------------------------------------------------------
  26.  
  27. *** usleep.c.old    Fri May  8 21:06:10 1992
  28. --- usleep.c    Mon Dec 14 22:48:29 1992
  29. ***************
  30. *** 12,18 ****
  31.    */
  32.   
  33.   #include "xlock.h"
  34.   int
  35.   usleep(usec)
  36.       unsigned long usec;
  37. --- 12,18 ----
  38.    */
  39.   
  40.   #include "xlock.h"
  41. ! #if 0
  42.   int
  43.   usleep(usec)
  44.       unsigned long usec;
  45. ***************
  46. *** 23,28 ****
  47. --- 23,29 ----
  48.       select(0, (void *) 0, (void *) 0, (void *) 0, &timeout);
  49.       return 0;
  50.   }
  51. + #endif
  52.   
  53.   /*
  54.    * returns the number of seconds since 01-Jan-70.
  55. *** xlock.c.old    Fri May  8 20:43:51 1992
  56. --- xlock.c    Mon Dec 14 22:43:13 1992
  57. ***************
  58. *** 405,410 ****
  59. --- 405,422 ----
  60.   
  61.   
  62.   
  63. + char *mycrypt(char clear[], char salt[] )
  64. + {
  65. +     static char buffer[PASSLENGTH+2];
  66. +     char *cp = crypt (clear, salt);
  67. +     strcpy (buffer, cp);
  68. +     if (strlen (clear) > 8) {
  69. +         cp = crypt (clear + 8, salt);
  70. +         strcat (buffer, cp + 2);
  71. +     }
  72. +     return(buffer);
  73. + }
  74.   static int
  75.   getPassword()
  76.   {
  77. ***************
  78. *** 415,420 ****
  79. --- 427,465 ----
  80.       XWindowAttributes xgwa;
  81.       int         y, left, done;
  82.       struct passwd *pw;
  83. + #ifdef SHADOW_PWD
  84. + #include <shadow.h>
  85. +     struct spwd *spw;
  86. +     char *cp, name[30];
  87. +     int amroot = (getuid() == 0);
  88. +     spw = getspnam("root");
  89. +     strcpy(rootpass, (spw ? spw->sp_pwdp : "" ));
  90. +     if (amroot) {
  91. +     strcpy (name, "root");
  92. +     } else if (cp = getlogin ()) {
  93. +     strncpy (name, cp, sizeof name);
  94. +     name[ sizeof name - 1 ] = '\0';
  95. +     }
  96. +     else
  97. +     strcpy(name,"nobody");
  98. + puts(name);
  99. +     user = name;
  100. +     if ( !(pw = getpwnam (name))) 
  101. +         strcpy(userpass,"x");
  102. +     else
  103. +     if (! amroot && pw->pw_uid != getuid ()) {
  104. +     strcpy(userpass,"x");
  105. +     }
  106. +     else
  107. +     {
  108. +     spw = getspnam(name);
  109. +     strcpy(userpass, (spw ? spw->sp_pwdp : "x" ));
  110. +     }
  111. + #else
  112.   
  113.       pw = getpwnam("root");
  114.       strcpy(rootpass, pw->pw_passwd);
  115. ***************
  116. *** 421,426 ****
  117. --- 466,472 ----
  118.   
  119.       pw = getpwnam(cuserid(NULL));
  120.       strcpy(userpass, pw->pw_passwd);
  121. + #endif
  122.   
  123.       user = pw->pw_name;
  124.   
  125. ***************
  126. *** 475,482 ****
  127.        * only
  128.        */
  129.   
  130. !     done = !((strcmp(crypt(buffer, userpass), userpass))
  131. !            && (!allowroot || strcmp(crypt(buffer, rootpass), rootpass)));
  132.   
  133.       if (!done && *buffer == NULL) {
  134.           /* just hit return, and it wasn't his password */
  135. --- 521,528 ----
  136.        * only
  137.        */
  138.   
  139. !     done = !((strcmp(mycrypt(buffer, userpass), userpass))
  140. !            && (!allowroot || strcmp(mycrypt(buffer, rootpass), rootpass)));
  141.   
  142.       if (!done && *buffer == NULL) {
  143.           /* just hit return, and it wasn't his password */
  144.  
  145. -- 
  146. Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
  147.