home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xnlock / patch2 < prev    next >
Encoding:
Text File  |  1992-03-17  |  7.4 KB  |  227 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: edsall@iastate.edu (David M Edsall)
  4. Subject: v17i022: xnlock patch (version 2.0.1), Patch2, Part01/01
  5. Message-ID: <1992Mar18.214136.16087@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i022-xnlock@uunet.UU.NET>
  10. Date: Wed, 18 Mar 1992 21:41:36 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: edsall@iastate.edu (David M Edsall)
  14. Posting-number: Volume 17, Issue 22
  15. Archive-name: xnlock/patch2
  16. Patch-To: xnlock: Volume 9, Issue 63
  17.  
  18.  
  19.      This is a patch to Dan Heller's xnlock program that locks a user's
  20. display and creates a little man running around spitting out dialogue to
  21. passersby. I modified the code so that it would retrieve the user's password
  22. from a file rather than from /etc/passwd since my system uses Kerberos for
  23. authenticating a user rather than /etc/passwd. You may also wish to change
  24. references of /usr/games/bin/dec/fortune to point to wherever fortune is kept
  25. on your system.
  26.  
  27.  
  28.      dave
  29.  
  30.  
  31. Submitted-by: edsall@iastate.edu
  32. Archive-name: xnlock patch2/part01
  33.  
  34. ---- Cut Here and feed the following to sh ----
  35. #!/bin/sh
  36. # This is xnlock patch2, a shell archive (produced by shar 3.49)
  37. # To extract the files from this archive, save it to a file, remove
  38. # everything above the "!/bin/sh" line above, and type "sh file_name".
  39. #
  40. # made 03/10/1992 04:07 UTC by edsall@iastate.edu
  41. # Source directory /home/edsall/build/X11/xnlock2
  42. #
  43. # existing files will NOT be overwritten unless -c is specified
  44. #
  45. # This shar contains:
  46. # length  mode       name
  47. # ------ ---------- ------------------------------------------
  48. #   4675 -rw------- patch2
  49. #
  50. # ============= patch2 ==============
  51. if test -f 'patch2' -a X"$1" != X"-c"; then
  52.     echo 'x - skipping patch2 (File already exists)'
  53. else
  54. echo 'x - extracting patch2 (Text)'
  55. sed 's/^X//' << 'SHAR_EOF' > 'patch2' &&
  56. Prereq: 1
  57. *** patchlevel.h.orig    Mon Mar  9 21:16:54 1992
  58. --- patchlevel.h    Mon Mar  9 21:17:27 1992
  59. ***************
  60. *** 1 ****
  61. ! #define PATCHLEVEL 1
  62. --- 1 ----
  63. ! #define PATCHLEVEL 2
  64. *** xnlock.c.orig    Mon Mar  9 21:22:29 1992
  65. --- xnlock.c    Mon Mar  9 21:21:45 1992
  66. ***************
  67. *** 16,22 ****
  68. X  #include <pwd.h>
  69. X  /* The program should be something that outputs a small amount of text */
  70. X  #ifndef DEFAULT_PROGRAM
  71. ! #define DEFAULT_PROGRAM "/usr/games/fortune -s"
  72. X  #endif
  73. X  #define font_height(font)          (font->ascent + font->descent)
  74. X  #define FONT_NAME    "-*-new century schoolbook-*-*-*-18-*"
  75. --- 16,22 ----
  76. X  #include <pwd.h>
  77. X  /* The program should be something that outputs a small amount of text */
  78. X  #ifndef DEFAULT_PROGRAM
  79. ! #define DEFAULT_PROGRAM "/usr/games/bin/dec/fortune -s"
  80. X  #endif
  81. X  #define font_height(font)          (font->ascent + font->descent)
  82. X  #define FONT_NAME    "-*-new century schoolbook-*-*-*-18-*"
  83. ***************
  84. *** 102,107 ****
  85. --- 102,109 ----
  86. X  int argc;
  87. X  char *argv[];
  88. X  {
  89. +     FILE *pwfile;
  90. +     char homedir[80],*hp=homedir;
  91. X      register int i;
  92. X      int foo;
  93. X      Widget override;
  94. ***************
  95. *** 115,124 ****
  96. X  
  97. X      /* getpwuid() returns static pointer, so get root's passwd first */
  98. X      if (!(pw = getpwuid(0)))
  99. !     printf("%s: can't get root's passwd!\n", ProgName), exit(1);
  100. X      strcpy(root_pw, pw->pw_passwd);
  101. X      if (!(pw = getpwuid(getuid())))
  102. !     printf("%s: Intruder alert!\n", ProgName), exit(1);
  103. X  
  104. X      XtToolkitInitialize();
  105. X      if (!(app = XtCreateApplicationContext()) ||
  106. --- 117,136 ----
  107. X  
  108. X      /* getpwuid() returns static pointer, so get root's passwd first */
  109. X      if (!(pw = getpwuid(0)))
  110. !     fprintf(stderr,"%s: can't get root's passwd!\n", ProgName), exit(1);
  111. X      strcpy(root_pw, pw->pw_passwd);
  112. X      if (!(pw = getpwuid(getuid())))
  113. !        fprintf(stderr,"%s: Intruder alert!\n", ProgName), exit(1);
  114. !     hp = getenv("HOME");
  115. !     if (!homedir) {
  116. !        fprintf(stderr,"Unable to locate home directory\n");
  117. !        exit(1);
  118. !     }
  119. !     strcat(hp,"/.xnlock");
  120. !     if ( !( pwfile = fopen(hp,"r") ) ) 
  121. !        fprintf(stderr,"Can't open %s\n",hp), exit(1);
  122. !     if (!(fscanf(pwfile,"%s",pw->pw_passwd)))
  123. !        fprintf(stderr,"%s: Can't get password\n", ProgName), exit(1);
  124. X  
  125. X      XtToolkitInitialize();
  126. X      if (!(app = XtCreateApplicationContext()) ||
  127. ***************
  128. *** 383,391 ****
  129. X      return;
  130. X      if (keysym == XK_Return || keysym == XK_Linefeed) {
  131. X      XExposeEvent event;
  132. !     passwd[cnt] = 0;
  133. X      XtRemoveTimeOut(timeout_id);
  134. !     if (!strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd))
  135. X          leave();
  136. X      if (Resrcs.accept_root &&
  137. X          (root_pw[0] == 0 && cnt == 0 ||
  138. --- 395,403 ----
  139. X      return;
  140. X      if (keysym == XK_Return || keysym == XK_Linefeed) {
  141. X      XExposeEvent event;
  142. !     passwd[cnt] = '\0';
  143. X      XtRemoveTimeOut(timeout_id);
  144. !     if (!strcmp(passwd, pw->pw_passwd))
  145. X          leave();
  146. X      if (Resrcs.accept_root &&
  147. X          (root_pw[0] == 0 && cnt == 0 ||
  148. *** xnlock.1.orig    Mon Mar  9 21:43:54 1992
  149. --- xnlock.1    Mon Mar  9 21:58:54 1992
  150. ***************
  151. *** 20,27 ****
  152. X  By default, the messages are "humorous", but that depends on your
  153. X  sense of humor.
  154. X  .LP
  155. ! If a key or mouse button is pressed, a prompt is printed requesting the
  156. ! user's password.  If a RETURN is not typed within 30 seconds,
  157. X  the little man resumes running around.
  158. X  .LP
  159. X  Text on the command line is used as the message.  For example:
  160. --- 20,33 ----
  161. X  By default, the messages are "humorous", but that depends on your
  162. X  sense of humor.
  163. X  .LP
  164. ! If a key or mouse button is pressed, a prompt is printed requesting the user's 
  165. ! .I xnlock
  166. ! password. The 
  167. ! .I xnlock 
  168. ! password is placed in a file named 
  169. ! .I .xnlock
  170. ! in the user's home directory. PLEASE MAKE SURE THAT THIS FILE IS 
  171. ! READABLE ONLY BY YOU! If a RETURN is not typed within 30 seconds,
  172. X  the little man resumes running around.
  173. X  .LP
  174. X  Text on the command line is used as the message.  For example:
  175. ***************
  176. *** 113,120 ****
  177. X  .br
  178. X  xnlock.acceptRootPasswd:   True/False
  179. X  .SH FILES
  180. ! \fIxnlock\fP               executable file
  181. X  .br
  182. X  ~/.msgfile                 default message file
  183. X  .SH AUTHOR
  184. X  Dan Heller <argv@sun.com>  Copyright (c) 1985, 1990.
  185. --- 119,128 ----
  186. X  .br
  187. X  xnlock.acceptRootPasswd:   True/False
  188. X  .SH FILES
  189. ! \fIxnlock\fP                     executable file
  190. X  .br
  191. + ~/.xnlock                  user's \fIxnlock\fP password file
  192. + .br
  193. X  ~/.msgfile                 default message file
  194. X  .SH AUTHOR
  195. X  Dan Heller <argv@sun.com>  Copyright (c) 1985, 1990.
  196. ***************
  197. *** 121,123 ****
  198. --- 129,132 ----
  199. X  .br
  200. X  The original version of this program was written using pixrects on
  201. X  a Sun 2 running SunOS 1.1.
  202. SHAR_EOF
  203. chmod 0600 patch2 ||
  204. echo 'restore of patch2 failed'
  205. Wc_c="`wc -c < 'patch2'`"
  206. test 4675 -eq "$Wc_c" ||
  207.     echo 'patch2: original size 4675, current size' "$Wc_c"
  208. fi
  209. exit 0
  210.  
  211.  
  212.  
  213. -- 
  214. ------------------------------------------------------------------------------
  215. | David M. Edsall       |        INTERNET:        |  Ask Iowa State why they |
  216. | Physics Grad Student  |   edsall@iastate.edu    |  are censoring my USENET |
  217. | Iowa State University | BITNET: edsall@alisuvax |  feed.  You are not      |
  218. | Ames Iowa             | HEPNET: isuhep::edsall  |  allowed to read this.   |
  219. ------------------------------------------------------------------------------
  220.  
  221. -- 
  222. --
  223. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  224. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  225. Sunnyvale, California 94086            at&t: 408/522-9236
  226.