[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-sysutils] All -f/--force option to force use of invalid shell in ch
From: |
Barry deFreese |
Subject: |
[Bug-sysutils] All -f/--force option to force use of invalid shell in chuser |
Date: |
Sat, 05 Jun 2004 18:13:11 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5 |
OK, I changed chuser to use -f to allow a "bogus" shell. I.E. chuser
-f shell=/bin/crap bddefreese
I don't know if it is the greatest implementation or not so if someone
could check it out I'd appreciate it.
Thanks,
--
Barry deFreese
Debian 3.0r1 "Woody"
GNU/Hurd
Registered Linux "Newbie" #302256 - Hurd H4XX0r wannabe
"Programming today is a race between software engineers striving
to build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots. So far, the Universe is
winning." Rich Cook.
Index: src/chuser.c
===================================================================
RCS file: /cvsroot/sysutils/sysutils/src/chuser.c,v
retrieving revision 1.5
diff -u -p -r1.5 chuser.c
--- src/chuser.c 5 Jun 2004 14:39:39 -0000 1.5
+++ src/chuser.c 6 Jun 2004 01:41:05 -0000
@@ -37,6 +37,8 @@
extern const char *progname;
+error_t force_shell(const char *string);
+
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
static char args_doc[] = N_("ATTRIBUTE=VALUE... USERS");
@@ -77,7 +79,8 @@ static char doc[] =
static struct argp_option options[] = {
{ "force", 'f', 0, 0,
- N_("force a change of username or id"), -2 },
+ N_("force a change of username, id "
+ "or allow a non-valid shell to be specified"), -2 },
{ "verbose", 'v', 0, 0,
N_("warn if the specified users does not exist"), -2 },
{ 0, 0, 0, 0, 0, 0 }
@@ -134,6 +137,13 @@ static error_t parse_opt(int key, char *
return status;
}
+error_t force_shell(const char *string) {
+ int status;
+
+ status = is_valid_string(string, "*?:,=");
+ return status;
+}
+
/**
* The program's main-function
*
@@ -353,6 +363,9 @@ int main(int argc, char *argv[])
status = EINVAL;
goto EXIT;
}
+
+ if (args.force)
+ attributes[13].validator = force_shell;
/* Parse the attribute=value pairs */
for (j = 0; j < (args.nargs - 1); j++) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-sysutils] All -f/--force option to force use of invalid shell in chuser,
Barry deFreese <=