summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2013-06-06 16:23:35 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-25 17:44:53 +0100
commit977fb9a916c1f2f7cb5ceba4db89d2e0155b37a1 (patch)
tree55c68bb8c3757a29414f7c14aa9862a57450be47 /meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch
parent8013f6e6aef28359d72ce3b21d5d704e19ceee69 (diff)
downloadpoky-977fb9a916c1f2f7cb5ceba4db89d2e0155b37a1.tar.gz
tinylogin: remove recipe
tinylogin has been deprecated and the functionality ported into busybox. We now use busybox as the login manager, so the tinylogin recipe could be deleted. [YOCTO #4207] (From OE-Core rev: 2762ff976a3473be4259889029e048ab8b3be5ab) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch')
-rw-r--r--meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch823
1 files changed, 0 insertions, 823 deletions
diff --git a/meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch b/meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch
deleted file mode 100644
index 33bc301a6e..0000000000
--- a/meta/recipes-core/tinylogin/tinylogin-1.4/cvs-20040608.patch
+++ /dev/null
@@ -1,823 +0,0 @@
1Upstream-Status: Backport
2
3Index: Config.h
4===================================================================
5RCS file: /var/cvs/tinylogin/Config.h,v
6retrieving revision 1.10
7retrieving revision 1.12
8diff -u -r1.10 -r1.12
9--- a/Config.h 23 Jun 2002 03:09:07 -0000 1.10
10+++ b/Config.h 17 Feb 2003 11:51:55 -0000 1.12
11@@ -27,15 +27,11 @@
12 // Enable checking of /etc/securetty by login
13 #define CONFIG_FEATURE_SECURETTY
14 //
15-// Enable using sha passwords
16-#define CONFIG_FEATURE_SHA1_PASSWORDS
17-//
18 // Enable use of a wheel group
19 #define CONFIG_WHEEL_GROUP
20 //
21-// This compiles out everything but the most
22-// trivial --help usage information (i.e. reduces binary size)
23-#define CONFIG_FEATURE_TRIVIAL_HELP
24+// Show verbose usage messages
25+//#define CONFIG_FEATURE_VERBOSE_USAGE
26 //
27 // Enable 'tinylogin --install [-s]' to allow tinylogin
28 // to create links (or symlinks) at runtime for all the
29@@ -48,10 +44,6 @@
30 // Nothing beyond this point should ever be touched by
31 // mere mortals so leave this stuff alone.
32 //
33-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
34-#define CONFIG_SHA1
35-#endif
36-//
37 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
38 #define CONFIG_SHADOW
39 #endif
40Index: addgroup.c
41===================================================================
42RCS file: /var/cvs/tinylogin/addgroup.c,v
43retrieving revision 1.22
44retrieving revision 1.23
45diff -u -r1.22 -r1.23
46--- a/addgroup.c 12 Dec 2002 08:46:03 -0000 1.22
47+++ b/addgroup.c 9 Jan 2003 18:43:29 -0000 1.23
48@@ -133,23 +133,33 @@
49 * ________________________________________________________________________ */
50 int addgroup_main(int argc, char **argv)
51 {
52+ int opt;
53 char *group;
54 char *user;
55 gid_t gid = 0;
56
57- if (argc < 2) {
58- show_usage();
59+ /* get remaining args */
60+ while ((opt = getopt (argc, argv, "g:")) != -1) {
61+ switch (opt) {
62+ case 'g':
63+ gid = strtol(optarg, NULL, 10);
64+ break;
65+ default:
66+ show_usage();
67+ break;
68+ }
69 }
70
71- if (strncmp(argv[1], "-g", 2) == 0) {
72- gid = strtol(argv[2], NULL, 10);
73- group = argv[2];
74+ if (optind < argc) {
75+ group = argv[optind];
76+ optind++;
77 } else {
78 show_usage();
79 }
80-
81- if (argc == 4) {
82- user = argv[3];
83+
84+ if (optind < argc) {
85+ user = argv[optind];
86+ optind++;
87 } else {
88 user = "";
89 }
90@@ -163,4 +173,4 @@
91 return addgroup(GROUP_FILE, group, gid, user);
92 }
93
94-/* $Id: addgroup.c,v 1.22 2002/12/12 08:46:03 andersen Exp $ */
95+/* $Id: addgroup.c,v 1.23 2003/01/09 18:43:29 andersen Exp $ */
96Index: adduser.c
97===================================================================
98RCS file: /var/cvs/tinylogin/adduser.c,v
99retrieving revision 1.37
100retrieving revision 1.38
101diff -u -r1.37 -r1.38
102--- a/adduser.c 12 Dec 2002 08:46:03 -0000 1.37
103+++ b/adduser.c 21 Jun 2003 19:35:42 -0000 1.38
104@@ -21,6 +21,9 @@
105 *
106 */
107
108+#ifndef _GNU_SOURCE
109+#define _GNU_SOURCE
110+#endif
111 #include <errno.h>
112 #include <fcntl.h>
113 #include <stdarg.h>
114@@ -29,6 +32,7 @@
115 #include <string.h>
116 #include <time.h>
117 #include <unistd.h>
118+#include <getopt.h>
119 #include <sys/param.h>
120 #include <sys/stat.h>
121 #include <sys/types.h>
122@@ -93,21 +97,23 @@
123 }
124 }
125
126- /* EDR check for an already existing gid */
127- while (getgrgid(p->pw_uid) != NULL)
128- p->pw_uid++;
129-
130- /* EDR also check for an existing group definition */
131- if (getgrnam(p->pw_name) != NULL)
132- return 3;
133+ if (p->pw_gid == 0) {
134+ /* EDR check for an already existing gid */
135+ while (getgrgid(p->pw_uid) != NULL)
136+ p->pw_uid++;
137+
138+ /* EDR also check for an existing group definition */
139+ if (getgrnam(p->pw_name) != NULL)
140+ return 3;
141+
142+ /* EDR create new gid always = uid */
143+ p->pw_gid = p->pw_uid;
144+ }
145
146 /* EDR bounds check */
147 if ((p->pw_uid > max) || (p->pw_uid < min))
148 return 2;
149
150- /* EDR create new gid always = uid */
151- p->pw_gid = p->pw_uid;
152-
153 /* return 1; */
154 return 0;
155 }
156@@ -136,7 +142,7 @@
157 }
158
159 /* putpwent(3) remix */
160-static int adduser(const char *filename, struct passwd *p)
161+static int adduser(const char *filename, struct passwd *p, int makehome, int setpass)
162 {
163 FILE *passwd;
164 int r;
165@@ -144,6 +150,11 @@
166 FILE *shadow;
167 struct spwd *sp;
168 #endif
169+ int new_group = 1;
170+
171+ /* if using a pre-existing group, don't create one */
172+ if (p->pw_gid != 0)
173+ new_group = 0;
174
175 /* make sure everything is kosher and setup uid && gid */
176 passwd = wfopen(filename, "a");
177@@ -194,29 +205,36 @@
178 }
179 #endif
180
181- /* add to group */
182- /* addgroup should be responsible for dealing w/ gshadow */
183- addgroup_wrapper(p->pw_name, p->pw_gid);
184+ if (new_group) {
185+ /* add to group */
186+ /* addgroup should be responsible for dealing w/ gshadow */
187+ addgroup_wrapper(p->pw_name, p->pw_gid);
188+ }
189
190 /* Clear the umask for this process so it doesn't
191 * * screw up the permissions on the mkdir and chown. */
192 umask(0);
193
194- /* mkdir */
195- if (mkdir(p->pw_dir, 0755)) {
196- perror_msg("%s", p->pw_dir);
197- }
198- /* Set the owner and group so it is owned by the new user. */
199- if (chown(p->pw_dir, p->pw_uid, p->pw_gid)) {
200- perror_msg("%s", p->pw_dir);
201- }
202- /* Now fix up the permissions to 2755. Can't do it before now
203- * since chown will clear the setgid bit */
204- if (chmod(p->pw_dir, 02755)) {
205- perror_msg("%s", p->pw_dir);
206+ if (makehome) {
207+ /* mkdir */
208+ if (mkdir(p->pw_dir, 0755)) {
209+ perror_msg("%s", p->pw_dir);
210+ }
211+ /* Set the owner and group so it is owned by the new user. */
212+ if (chown(p->pw_dir, p->pw_uid, p->pw_gid)) {
213+ perror_msg("%s", p->pw_dir);
214+ }
215+ /* Now fix up the permissions to 2755. Can't do it before now
216+ * since chown will clear the setgid bit */
217+ if (chmod(p->pw_dir, 02755)) {
218+ perror_msg("%s", p->pw_dir);
219+ }
220+ }
221+
222+ if (setpass) {
223+ /* interactively set passwd */
224+ passwd_wrapper(p->pw_name);
225 }
226- /* interactively set passwd */
227- passwd_wrapper(p->pw_name);
228
229 return 0;
230 }
231@@ -228,6 +246,15 @@
232 return geteuid();
233 }
234
235+struct option long_options[] = {
236+ { "home", 1, NULL, 'h' },
237+ { "disabled-password", 0, NULL, 'D' },
238+ { "system", 0, NULL, 'S' },
239+ { "ingroup", 1, NULL, 'G' },
240+ { "no-create-home", 0, NULL, 'H' },
241+ { 0, 0, 0, 0 }
242+};
243+
244 /*
245 * adduser will take a login_name as its first parameter.
246 *
247@@ -244,6 +271,11 @@
248 const char *gecos;
249 const char *home = NULL;
250 const char *shell;
251+ const char *usegroup = NULL;
252+ int option_index = -1;
253+ int setpass = 1;
254+ int makehome = 1;
255+ int system = 0;
256
257 struct passwd pw;
258
259@@ -255,7 +287,7 @@
260 shell = default_shell;
261
262 /* get args */
263- while ((opt = getopt (argc, argv, "h:g:s:")) != -1) {
264+ while ((opt = getopt_long (argc, argv, "h:g:s:G:DSH", long_options, &option_index)) != -1) {
265 switch (opt) {
266 case 'h':
267 home = optarg;
268@@ -266,6 +298,18 @@
269 case 's':
270 shell = optarg;
271 break;
272+ case 'H':
273+ makehome = 0;
274+ break;
275+ case 'D':
276+ setpass = 0;
277+ break;
278+ case 'S':
279+ system = 1;
280+ break;
281+ case 'G':
282+ usegroup = optarg;
283+ break;
284 default:
285 show_usage ();
286 break;
287@@ -301,8 +345,19 @@
288 pw.pw_dir = (char *)home;
289 pw.pw_shell = (char *)shell;
290
291+ if (usegroup) {
292+ /* Add user to a group that already exists */
293+ struct group *g;
294+
295+ g = getgrnam(usegroup);
296+ if (g == NULL)
297+ error_msg_and_die("group %s does not exist", usegroup);
298+
299+ pw.pw_gid = g->gr_gid;
300+ }
301+
302 /* grand finale */
303- return adduser(PASSWD_FILE, &pw);
304+ return adduser(PASSWD_FILE, &pw, makehome, setpass);
305 }
306
307-/* $Id: adduser.c,v 1.37 2002/12/12 08:46:03 andersen Exp $ */
308+/* $Id: adduser.c,v 1.38 2003/06/21 19:35:42 andersen Exp $ */
309Index: install.sh
310===================================================================
311RCS file: /var/cvs/tinylogin/install.sh,v
312retrieving revision 1.10
313retrieving revision 1.11
314diff -u -r1.10 -r1.11
315--- a/install.sh 23 Jun 2002 03:09:07 -0000 1.10
316+++ b/install.sh 6 Mar 2003 19:29:17 -0000 1.11
317@@ -21,11 +21,11 @@
318 h=`sort tinylogin.links | uniq`
319
320
321-mkdir -p $prefix/bin || exit 1
322+install -d -m 0755 $prefix/bin || exit 1
323
324 for i in $h ; do
325 appdir=`dirname $i`
326- mkdir -p $prefix/$appdir || exit 1
327+ install -d -m 0755 $prefix/$appdir || exit 1
328 if [ "$2" = "--hardlinks" ]; then
329 bb_path="$prefix/bin/tinylogin"
330 else
331Index: passwd.c
332===================================================================
333RCS file: /var/cvs/tinylogin/passwd.c,v
334retrieving revision 1.19
335retrieving revision 1.20
336diff -u -r1.19 -r1.20
337--- a/passwd.c 7 Nov 2002 02:34:15 -0000 1.19
338+++ b/passwd.c 17 Feb 2003 11:51:55 -0000 1.20
339@@ -25,10 +25,6 @@
340 {
341 int x = 0; /* standart: DES */
342
343-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
344- if (strcasecmp(a, "sha1") == 0)
345- x = 2;
346-#endif
347 if (strcasecmp(a, "md5") == 0)
348 x = 1;
349 return x;
350@@ -394,11 +390,6 @@
351 bzero(cp, strlen(cp));
352 bzero(orig, sizeof(orig));
353
354-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
355- if (algo == 2) {
356- cp = pw_encrypt(pass, "$2$");
357- } else
358-#endif
359 if (algo == 1) {
360 cp = pw_encrypt(pass, "$1$");
361 } else
362Index: sha1.c
363===================================================================
364RCS file: sha1.c
365diff -N sha1.c
366--- a/sha1.c 20 Dec 2000 21:54:28 -0000 1.2
367+++ /dev/null 1 Jan 1970 00:00:00 -0000
368@@ -1,187 +0,0 @@
369-/* vi: set sw=4 ts=4: */
370-/*
371- Implements the Secure Hash Algorithm (SHA1)
372-
373- Copyright (C) 1999 Scott G. Miller
374-
375- Released under the terms of the GNU General Public License v2
376- see file COPYING for details
377-
378- Credits:
379- Robert Klep <robert@ilse.nl> -- Expansion function fix
380- ---
381- FIXME: This source takes int to be a 32 bit integer. This
382- may vary from system to system. I'd use autoconf if I was familiar
383- with it. Anyone want to help me out?
384-*/
385-
386-void sha_hash(int *, int *);
387-void sha_init(int *);
388-char *sprint_hash(int *);
389-void do_sha_hash(int *, int *);
390-
391-/*
392- added 3 functions for sha passowrd stuff (mainly inspired from stuff seen in main.c from shasum-1.3 package)
393-*/
394-#include <stdio.h>
395-#include <string.h>
396-#include <stdlib.h>
397-
398-#include <endian.h>
399-/* On big endian machines, we need to reverse the input to process
400- the blocks correctly */
401-
402-#define switch_endianness(x) (x<<24 & 0xff000000) | \
403- (x<<8 & 0x00ff0000) | \
404- (x>>8 & 0x0000ff00) | \
405- (x>>24 & 0x000000ff)
406-
407-/* Initial hash values */
408-#define Ai 0x67452301
409-#define Bi 0xefcdab89
410-#define Ci 0x98badcfe
411-#define Di 0x10325476
412-#define Ei 0xc3d2e1f0
413-
414-/* SHA1 round constants */
415-#define K1 0x5a827999
416-#define K2 0x6ed9eba1
417-#define K3 0x8f1bbcdc
418-#define K4 0xca62c1d6
419-
420-/* Round functions. Note that f2() is used in both rounds 2 and 4 */
421-#define f1(B,C,D) ((B & C) | ((~B) & D))
422-#define f2(B,C,D) (B ^ C ^ D)
423-#define f3(B,C,D) ((B & C) | (B & D) | (C & D))
424-
425-/* left circular shift functions (rotate left) */
426-#define rol1(x) ((x<<1) | ((x>>31) & 1))
427-#define rol5(A) ((A<<5) | ((A>>27) & 0x1f))
428-#define rol30(B) ((B<<30) | ((B>>2) & 0x3fffffff))
429-
430-/*
431- Hashes 'data', which should be a pointer to 512 bits of data (sixteen
432- 32 bit ints), into the ongoing 160 bit hash value (five 32 bit ints)
433- 'hash'
434-*/
435-void sha_hash(int *data, int *hash)
436-{
437- int W[80];
438- unsigned int A = hash[0], B = hash[1], C = hash[2], D = hash[3], E =
439- hash[4];
440- unsigned int t, x, TEMP;
441-
442- for (t = 0; t < 16; t++) {
443-#ifdef BIG_ENDIAN
444- W[t] = switch_endianness(data[t]);
445-#else
446- W[t] = data[t];
447-#endif
448- }
449-
450-
451- /* SHA1 Data expansion */
452- for (t = 16; t < 80; t++) {
453- x = W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16];
454- W[t] = rol1(x);
455- }
456-
457- /* SHA1 main loop (t=0 to 79)
458- This is broken down into four subloops in order to use
459- the correct round function and constant */
460- for (t = 0; t < 20; t++) {
461- TEMP = rol5(A) + f1(B, C, D) + E + W[t] + K1;
462- E = D;
463- D = C;
464- C = rol30(B);
465- B = A;
466- A = TEMP;
467- }
468- for (; t < 40; t++) {
469- TEMP = rol5(A) + f2(B, C, D) + E + W[t] + K2;
470- E = D;
471- D = C;
472- C = rol30(B);
473- B = A;
474- A = TEMP;
475- }
476- for (; t < 60; t++) {
477- TEMP = rol5(A) + f3(B, C, D) + E + W[t] + K3;
478- E = D;
479- D = C;
480- C = rol30(B);
481- B = A;
482- A = TEMP;
483- }
484- for (; t < 80; t++) {
485- TEMP = rol5(A) + f2(B, C, D) + E + W[t] + K4;
486- E = D;
487- D = C;
488- C = rol30(B);
489- B = A;
490- A = TEMP;
491- }
492- hash[0] += A;
493- hash[1] += B;
494- hash[2] += C;
495- hash[3] += D;
496- hash[4] += E;
497-}
498-
499-/*
500- Takes a pointer to a 160 bit block of data (five 32 bit ints) and
501- intializes it to the start constants of the SHA1 algorithm. This
502- must be called before using hash in the call to sha_hash
503-*/
504-void sha_init(int *hash)
505-{
506- hash[0] = Ai;
507- hash[1] = Bi;
508- hash[2] = Ci;
509- hash[3] = Di;
510- hash[4] = Ei;
511-}
512-
513-
514-/*
515- * write the hash to a string
516- */
517-char *sprint_sha1_hash(int *hashval)
518-{
519- int x = 0;
520- char *out = NULL;
521-
522- if ((out = malloc(43)) == NULL)
523- return NULL;
524- memset(out, 0x00, 43);
525- strcpy(out, "$2$");
526- for (x = 0; x < 5; x++) {
527- sprintf(out + (x * 8) + 3, "%08x", hashval[x]);
528- }
529- out[43] = 0;
530- return out;
531-}
532-
533-
534-/*
535- * hash the password
536- */
537-void do_sha_hash(int *hashval, int *pw)
538-{
539- sha_init(hashval);
540- sha_hash(pw, hashval);
541-}
542-
543-
544-/*
545- * hash a charakter string and return the 160bit integer in hex as a character string
546- */
547-char *sha1_crypt(const char *pw)
548-{
549- int hashval[20];
550-
551- memset(hashval, 0x00, sizeof(hashval));
552- do_sha_hash(hashval, (int *) ((char *) pw + 3));
553-
554- return sprint_sha1_hash(hashval);
555-}
556Index: vlock.c
557===================================================================
558RCS file: /var/cvs/tinylogin/vlock.c,v
559retrieving revision 1.13
560retrieving revision 1.14
561diff -u -r1.13 -r1.14
562--- a/vlock.c 19 Sep 2002 03:50:31 -0000 1.13
563+++ b/vlock.c 17 Feb 2003 11:51:56 -0000 1.14
564@@ -26,7 +26,7 @@
565 * minimalistic vlock.
566 */
567 /* Fixed by Erik Andersen to do passwords the tinylogin way...
568- * It now works with md5, sha1, etc passwords. */
569+ * It now works with md5, etc passwords. */
570
571 #include "tinylogin.h"
572 #include <stdio.h>
573Index: docs/tinylogin.busybox.net/index.html
574===================================================================
575RCS file: /var/cvs/tinylogin/docs/tinylogin.busybox.net/index.html,v
576retrieving revision 1.23
577retrieving revision 1.25
578diff -u -r1.23 -r1.25
579--- a/docs/tinylogin.busybox.net/index.html 3 Jan 2003 10:56:32 -0000 1.23
580+++ b/docs/tinylogin.busybox.net/index.html 3 Jan 2003 11:21:53 -0000 1.25
581@@ -56,6 +56,9 @@
582 Erik Andersen</a>, and licensed under the
583 <a href="http://www.gnu.org/copyleft/gpl.html">GNU GENERAL PUBLIC LICENSE</a>.
584
585+<h3>Mailing List Information</h3>
586+Here are the Tinylogin <a href="/lists/tinylogin/">mailing list archives</a><br>
587+To subscribe, go and visit <a href= "/mailman/listinfo/tinylogin">this page</a>.
588
589 <!-- Begin Download section -->
590
591@@ -222,19 +225,19 @@
592 <ul>
593 <li> <A HREF="http://freshmeat.net/projects/tinylogin/?highlight=tinylogin">
594 Freshmeat AppIndex record for TinyLogin</A>
595+ <p>
596
597 <li><a href="http://www.busybox.net/">BusyBox</a>
598 combines tiny versions of many common UNIX utilities into a single small
599 executable. It provides minimalist replacements for most of the utilities
600 you usually find on a standard Linux system.
601-
602 <p>
603+
604 <li><a href="http://uclibc.org/uClibc.html">uClibc</a>
605 is a C library for embedded systems. You can actually statically link
606 a "Hello World" application under x86 that only takes 4k (as opposed to
607 200k under GNU libc). It can do dynamic linking too and works nicely with
608 BusyBox to create very small embedded systems.
609-
610 <p>
611
612 </ul>
613Index: include/libbb.h
614===================================================================
615RCS file: /var/cvs/tinylogin/include/libbb.h,v
616retrieving revision 1.1
617retrieving revision 1.2
618diff -u -r1.1 -r1.2
619--- a/include/libbb.h 23 Jun 2002 03:09:10 -0000 1.1
620+++ b/include/libbb.h 17 Feb 2003 11:51:57 -0000 1.2
621@@ -39,9 +39,6 @@
622 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
623 #include "shadow_.h"
624 #endif
625-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
626-# include "sha1.h"
627-#endif
628
629 #if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
630 /* libc5 doesn't define socklen_t */
631Index: include/sha1.h
632===================================================================
633RCS file: include/sha1.h
634diff -N include/sha1.h
635--- a/include/sha1.h 23 Jun 2002 03:09:10 -0000 1.1
636+++ /dev/null 1 Jan 1970 00:00:00 -0000
637@@ -1,3 +0,0 @@
638-/* SHA1.H - header file for SHA1.C */
639-
640-char *sha1_crypt(const char *pw);
641Index: include/usage.h
642===================================================================
643RCS file: /var/cvs/tinylogin/include/usage.h,v
644retrieving revision 1.2
645retrieving revision 1.3
646diff -u -r1.2 -r1.3
647--- a/include/usage.h 3 Jul 2002 05:57:00 -0000 1.2
648+++ b/include/usage.h 17 Feb 2003 11:51:57 -0000 1.3
649@@ -33,11 +33,6 @@
650 "\t-h\tName of the remote host for this login.\n" \
651 "\t-p\tPreserve environment."
652
653-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
654- #define PASSWORD_ALG_TYPES(a) a
655-#else
656- #define PASSWORD_ALG_TYPES(a)
657-#endif
658 #define passwd_trivial_usage \
659 "[OPTION] [name]"
660 #define passwd_full_usage \
661@@ -46,7 +41,6 @@
662 "Options:\n" \
663 "\t-a\tDefine which algorithm shall be used for the password.\n" \
664 "\t\t\t(Choices: des, md5" \
665- PASSWORD_ALG_TYPES(", sha1") \
666 ")\n\t-d\tDelete the password for the specified user account.\n" \
667 "\t-l\tLocks (disables) the specified user account.\n" \
668 "\t-u\tUnlocks (re-enables) the specified user account."
669Index: libbb/obscure.c
670===================================================================
671RCS file: /var/cvs/tinylogin/libbb/obscure.c,v
672retrieving revision 1.2
673retrieving revision 1.3
674diff -u -r1.2 -r1.3
675--- a/libbb/obscure.c 23 Jun 2002 04:05:59 -0000 1.2
676+++ b/libbb/obscure.c 30 Jul 2003 08:41:33 -0000 1.3
677@@ -44,7 +44,7 @@
678 * can't be a palindrome - like `R A D A R' or `M A D A M'
679 */
680
681-static int palindrome(const char *old, const char *newval)
682+static int palindrome(const char *newval)
683 {
684 int i, j;
685
686@@ -79,24 +79,25 @@
687 * a nice mix of characters.
688 */
689
690-static int simple(const char *old, const char *newval)
691+static int simple(const char *newval)
692 {
693 int digits = 0;
694 int uppers = 0;
695 int lowers = 0;
696 int others = 0;
697+ int c;
698 int size;
699 int i;
700
701- for (i = 0; newval[i]; i++) {
702- if (isdigit(newval[i]))
703- digits++;
704- else if (isupper(newval[i]))
705- uppers++;
706- else if (islower(newval[i]))
707- lowers++;
708+ for (i = 0; (c = *newval++) != 0; i++) {
709+ if (isdigit(c))
710+ digits = c;
711+ else if (isupper(c))
712+ uppers = c;
713+ else if (islower(c))
714+ lowers = c;
715 else
716- others++;
717+ others = c;
718 }
719
720 /*
721@@ -129,49 +130,53 @@
722 return string;
723 }
724
725-static char *password_check(const char *old, const char *newval, const struct passwd *pwdp)
726+static const char *
727+password_check(const char *old, const char *newval, const struct passwd *pwdp)
728 {
729- char *msg = NULL;
730- char *oldmono, *newmono, *wrapped;
731+ const char *msg;
732+ char *newmono, *wrapped;
733+ int lenwrap;
734
735 if (strcmp(newval, old) == 0)
736 return "no change";
737+ if (simple(newval))
738+ return "too simple";
739
740+ msg = NULL;
741 newmono = str_lower(xstrdup(newval));
742- oldmono = str_lower(xstrdup(old));
743- wrapped = (char *) xmalloc(strlen(oldmono) * 2 + 1);
744- strcpy(wrapped, oldmono);
745- strcat(wrapped, oldmono);
746+ lenwrap = strlen(old) * 2 + 1;
747+ wrapped = (char *) xmalloc(lenwrap);
748+ str_lower(strcpy(wrapped, old));
749
750- if (palindrome(oldmono, newmono))
751+ if (palindrome(newmono))
752 msg = "a palindrome";
753
754- if (!msg && strcmp(oldmono, newmono) == 0)
755+ else if (strcmp(wrapped, newmono) == 0)
756 msg = "case changes only";
757
758- if (!msg && similiar(oldmono, newmono))
759+ else if (similiar(wrapped, newmono))
760 msg = "too similiar";
761
762- if (!msg && simple(old, newval))
763- msg = "too simple";
764-
765- if (!msg && strstr(wrapped, newmono))
766- msg = "rotated";
767+ else {
768+ safe_strncpy(wrapped + lenwrap, wrapped, lenwrap + 1);
769+ if (strstr(wrapped, newmono))
770+ msg = "rotated";
771+ }
772
773 bzero(newmono, strlen(newmono));
774- bzero(oldmono, strlen(oldmono));
775- bzero(wrapped, strlen(wrapped));
776+ bzero(wrapped, lenwrap);
777 free(newmono);
778- free(oldmono);
779 free(wrapped);
780
781 return msg;
782 }
783
784-static char *obscure_msg(const char *old, const char *newval, const struct passwd *pwdp)
785+static const char *
786+obscure_msg(const char *old, const char *newval, const struct passwd *pwdp)
787 {
788 int maxlen, oldlen, newlen;
789- char *new1, *old1, *msg;
790+ char *new1, *old1;
791+ const char *msg;
792
793 oldlen = strlen(old);
794 newlen = strlen(newval);
795@@ -233,7 +238,7 @@
796
797 extern int obscure(const char *old, const char *newval, const struct passwd *pwdp)
798 {
799- char *msg = obscure_msg(old, newval, pwdp);
800+ const char *msg = obscure_msg(old, newval, pwdp);
801
802 /* if (msg) { */
803 if (msg != NULL) {
804Index: libbb/pw_encrypt.c
805===================================================================
806RCS file: /var/cvs/tinylogin/libbb/pw_encrypt.c,v
807retrieving revision 1.1
808retrieving revision 1.2
809diff -u -r1.1 -r1.2
810--- a/libbb/pw_encrypt.c 23 Jun 2002 03:09:12 -0000 1.1
811+++ b/libbb/pw_encrypt.c 17 Feb 2003 11:51:58 -0000 1.2
812@@ -30,11 +30,6 @@
813 static char cipher[128];
814 char *cp;
815
816-#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
817- if (strncmp(salt, "$2$", 3) == 0) {
818- return sha1_crypt(clear);
819- }
820-#endif
821 cp = (char *) crypt(clear, salt);
822 /* if crypt (a nonstandard crypt) returns a string too large,
823 truncate it so we don't overrun buffers and hope there is