updated the readme to reflect changes
This commit is contained in:
@@ -8,8 +8,13 @@ For most hardware, this would actually amount to just reporting epoc for root,
|
|||||||
as most devices won't directly have users. Applications on those may, but those
|
as most devices won't directly have users. Applications on those may, but those
|
||||||
usually have their own user management features.
|
usually have their own user management features.
|
||||||
|
|
||||||
This patch adds the `-b` option to BusyBox's adduser, and will record a birthday
|
This file replaces the adduser.c in BusyBox, and it differs from the original in
|
||||||
in YYYYMMDD format. This can then be used to determine age, and/or the age
|
offering a `-b` option which will add user's birthday to `/etc/birthdays`. The
|
||||||
bracket of the user via the standard UNIX shell which serves as the UNIX
|
birthday needs to be passed in YYYYMMDD format, and it will be stored as such.
|
||||||
API/ABI, and thus makes BusyBox compliant with the law. The two UNIX commands
|
|
||||||
added here are `howoldami` and `useragerange`.
|
Two example scripts exist here to offer the commands `howoldami` and
|
||||||
|
`useragerange` which will provide either the user's age or one of the age ranges
|
||||||
|
specified in California's bill. As the standard UNIX interface and signal system
|
||||||
|
is plain text, this change to adduser and the accompanying scripts transform the
|
||||||
|
BusyBox + Linux system into a compliant operating system for those who require
|
||||||
|
it.
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
--- loginutils/adduser.c.orig
|
|
||||||
+++ loginutils/adduser.c
|
|
||||||
@@ -44,6 +44,7 @@
|
|
||||||
//usage: "\n\t-H\t\tDon't create home directory"
|
|
||||||
//usage: "\n\t-u UID\t\tUser id"
|
|
||||||
//usage: "\n\t-k SKEL\t\tSkeleton directory (/etc/skel)"
|
|
||||||
+//usage: "\n\t-b DOB\t\tDate of birth (YYYYMMDD)"
|
|
||||||
|
|
||||||
#include "libbb.h"
|
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@
|
|
||||||
#define OPT_DONT_MAKE_HOME (1 << 6)
|
|
||||||
#define OPT_UID (1 << 7)
|
|
||||||
#define OPT_SKEL (1 << 8)
|
|
||||||
+#define OPT_DOB (1 << 9)
|
|
||||||
|
|
||||||
/* remix */
|
|
||||||
/* recoded such that the uid may be passed in *p */
|
|
||||||
@@ -128,6 +130,7 @@
|
|
||||||
"no-create-home\0" No_argument "H"
|
|
||||||
"uid\0" Required_argument "u"
|
|
||||||
"skel\0" Required_argument "k"
|
|
||||||
+ "dob\0" Required_argument "b"
|
|
||||||
;
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -141,6 +144,7 @@
|
|
||||||
unsigned opts;
|
|
||||||
char *uid;
|
|
||||||
const char *skel = "/etc/skel";
|
|
||||||
+ char *dob = NULL;
|
|
||||||
|
|
||||||
/* got root? */
|
|
||||||
if (geteuid()) {
|
|
||||||
@@ -151,7 +155,7 @@
|
|
||||||
pw.pw_dir = NULL;
|
|
||||||
|
|
||||||
opts = getopt32long(argv, "^"
|
|
||||||
- "h:g:s:G:DSHu:k:"
|
|
||||||
+ "h:g:s:G:DSHu:k:b:"
|
|
||||||
/* at least one and at most two non-option args */
|
|
||||||
/* disable interactive passwd for system accounts */
|
|
||||||
"\0" "-1:?2:SD",
|
|
||||||
@@ -158,7 +162,7 @@
|
|
||||||
adduser_longopts,
|
|
||||||
&pw.pw_dir, &pw.pw_gecos, &pw.pw_shell,
|
|
||||||
&usegroup, &uid, &skel
|
|
||||||
- &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell,
|
|
||||||
+ &usegroup, &uid, &skel, &dob
|
|
||||||
);
|
|
||||||
if (opts & OPT_UID)
|
|
||||||
pw.pw_uid = atoi(uid);
|
|
||||||
@@ -200,6 +204,16 @@
|
|
||||||
free(p);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ /* Record date of birth if specified */
|
|
||||||
+ if (opts & OPT_DOB) {
|
|
||||||
+ FILE *f = fopen("/etc/birthdays", "a");
|
|
||||||
+ if (f) {
|
|
||||||
+ fprintf(f, "%s:x:%s:\n", pw.pw_name, dob);
|
|
||||||
+ fclose(f);
|
|
||||||
+ } else {
|
|
||||||
+ bb_perror_msg("/etc/birthdays");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* add to group */
|
|
||||||
addgroup_wrapper(&pw, usegroup);
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user