home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21873 < prev    next >
Encoding:
Text File  |  1992-12-28  |  6.1 KB  |  151 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!drycas.club.cc.cmu.edu!ghod
  2. From: ghod@drycas.club.cc.cmu.edu
  3. Newsgroups: comp.os.linux
  4. Subject: Re: xdm without rc.local and other stuff
  5. Message-ID: <1992Dec28.003858.2801@drycas.club.cc.cmu.edu>
  6. Date: 28 Dec 92 00:38:58 -0500
  7. References: <1992Dec27.063227.23838@sol.UVic.CA>
  8. Organization: Carnegie Mellon Computer Club
  9. Lines: 140
  10.  
  11. In article <1992Dec27.063227.23838@sol.UVic.CA>, pmacdona@sanjuan (Peter MacDonald) writes:
  12. > I am working on fixing some of the most commonly posted problems
  13. > or requested features for the next SLS.  One of them is xdm.
  14. > I have recompiled it, and am trying to find a way to start it 
  15. > without putting it in rc.local (ie, from the command line).
  16. > Can someone offer up any help?
  17. I think I can. Someone posted the following suggestion for getting xdm running
  18. from the command line *without* the -nodaemon flag, prior to the release of
  19. 0.99:
  20.  
  21. Invoke xdm as follows:
  22.  
  23. skynet{1}# xdm; exec < /dev/tty8; exec > /dev/tty8
  24.  
  25. (Note that I think you can substitute tty8 with any tty that doesn't currently
  26. have a getty running on it. Wonder what would happen if you used /dev/null?)
  27.  
  28. I've tried this on my own system and I've veriffied that it works (I've got
  29. 0.99 pl1 going). This is a kludge, of course: just plain xdm -nodaemon should
  30. still work, but it doesn't. I'm 
  31.  
  32. > Xdm, xlock etc had to be recompiled because of shadow passwords.
  33. > Effectively, these programs, plus any others that let new users
  34. > into the system (ie, check passwords), must now be suid root.
  35. > Ditto for ftpd.
  36.  
  37. [stuff deleted]
  38.  
  39. > suid root.  One caveat is that xlock had to be changed to use:
  40. >     pw=getpwuid(getuid())
  41. > instead of
  42. >     pw=getpwnam(cuserid(NULL))
  43. > This because of the suid.  If anyone thinks this is a security
  44. > problem, let me know.  Xdm need no source changes, other than
  45. > to delete a few "extern char *crypt()" defs.
  46.  
  47. Heh... Yup, I recognize that problem. :) I re-compiled xlock myself (I'm an
  48. impatient sod) and was quite surprised when I ran it the first time as
  49. a normal user and was prompted to enter the root password. I don't think
  50. there is a security problem inherent in running xlock setuid root, since I
  51. can't see any way for someone to trick xlock into actually modifying the shadow
  52. password file, or creating any other files. Unless, of course, it core 
  53. dumps. :)
  54.  
  55. BTW, I went and got the source to xdm from my local X11R5 distribution and 
  56. modified it (as well as the aforementioned xlock -- ftpd is next on my list) 
  57. for shadows password myself, but what I did was to write a small add-on module 
  58. called getshadow.c to implement a sort of kluged up getspnam() function. 
  59. Actually, it's much simpler than getspwnam() -- you just pass it a username 
  60. and it returns a pointer to a string containing the encrypted password for 
  61. that user:
  62.  
  63.  
  64. #include <stdio.h>
  65. #include <string.h>
  66. #include <unistd.h>
  67. #define SHADOW "/etc/shadow"
  68.  
  69.  
  70. char *getshadow(user)
  71. char *user;
  72. {
  73.         FILE *sfile;
  74.         char entry[512];
  75.         static char password[13];
  76.  
  77.         sfile = fopen(SHADOW,"r");
  78.         while(fgets(entry,sizeof(entry),sfile)) {
  79.                 if (strstr(entry,user)) {
  80.                         strncpy(password,strchr(entry,':')+1,sizeof(password));
  81.                         fclose(sfile);
  82.                         return password;
  83.                         }
  84.                 }
  85.  
  86.         fclose(sfile);
  87.         return NULL;
  88. }
  89.  
  90. Before you say it, there's two things wrong with this code. It looks for the
  91. first occurence of a ':' in the line it reads from /etc/shadow and just
  92. assumes that the next 13 characters are the encrypted password. Most of the
  93. time this is true, but the password comparisson will fail if the password 
  94. field is empty (::).
  95.  
  96. (In a way, this is good since it disallows logins to users with null passwords,
  97. like sync, but it's still sloppy. In retrospect though, it seems to me that the
  98. new passwd program still generates a 13 character encrypted mess even if you
  99. just type <RETURN> as the password. :)
  100.  
  101. Second, it assumes the encrypted password is only 13 characters long, which I
  102. have noticed is not always so (but I think it should be). I tend to use a
  103. password for my user account that is actually 9 characters long. Normally,
  104. most unix password/login programs only use the first 8 characters of the
  105. cleartext password and ignore the rest, but for this user account with a 9
  106. character cleartext password, I get this:
  107.  
  108. wpaul:tPiPVlgffntkIYicTiVpkprw:8392:0:10000
  109.  
  110. The password field here is 24 characters long. Nobody else seems to have
  111. mentioned anything about this before, so I don't know if it's a common
  112. occurence or if it's just me.
  113.  
  114. [stuff about next SLS release deleted]
  115.  
  116. That reminds me: I have a question for you about the current SLS release.
  117. Exactly what version of the kernel & which options were used for the a1 
  118. disk? I ask because I ran into a really strange problem the other day: I've
  119. got a friend with 486 33 and a Data Technologies DTC 3292 SCSI adapter (and
  120. a Seagate ST3283N drive). The kernel on the a1 disk seems to boot & recognize
  121. his SCSI setup correctly, but the boot disk generated by the doinstall script
  122. doesn't. I rigged the a1 disk to serve as his boot disk, but I can't keep it
  123. like that since the a1 disk doesn't have TCP/IP in it. In other words, the
  124. kernel that supports his drive doesn't have networking, and the kernel that
  125. has networking doesn't support his drive. Catch 22. This means he can't run X.
  126. The boot messages from the a1 disk say 0.98 pl5 49 (I think), and I went and
  127. got the sources to 0.98 pl5 and made him a new kernel (which I won't get to
  128. test for a few days) but I'm not convinced it's going to work. I would have
  129. thought that the SCSI drivers in the 0.99 kernel would have worked, but they
  130. flatly ignore the presence of his host adapter. Meanwhile, the same 0.99 kernel
  131. tested fine on an Adaptek 1542. I *told* him to get an Adaptek, but noooo.....
  132. Anyway, if anyone knows why it is that the 0.98 kernel likes his SCSI stuff
  133. and the 0.99 doesn't please respond.
  134.  
  135. -Bill Paul
  136.  
  137. ghod@drycas.club.cc.cmu.edu   or   ghod@drycas.bitnet
  138. (Or, in an emergency, wpaul@uhasun.hartford.edu)
  139.  
  140.  
  141.  
  142. > Peter.
  143. > pmacdona@sanjuan.uvic.ca
  144.