FreeBSD Bugzilla – Attachment 187753 Details for
Bug 223431
"pw useradd -D -e" writes bogus expire_days value into pw.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
fix -e with -D
pw.diff (text/plain), 1.19 KB, created by
Yuri Pankov
on 2017-11-05 12:04:07 UTC
(
hide
)
Description:
fix -e with -D
Filename:
MIME Type:
Creator:
Yuri Pankov
Created:
2017-11-05 12:04:07 UTC
Size:
1.19 KB
patch
obsolete
>diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c >index 92d5c6c5dbb5..a2e0341172cd 100644 >--- a/usr.sbin/pw/pw_user.c >+++ b/usr.sbin/pw/pw_user.c >@@ -22,7 +22,7 @@ > * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. >- * >+ * > */ > > #ifndef lint >@@ -1182,6 +1182,7 @@ pw_user_add(int argc, char **argv, char *arg1) > char *gecos, *homedir, *skel, *walk, *userid, *groupid, *grname; > char *default_passwd, *name, *p; > const char *cfg = NULL; >+ const char *errstr; > login_cap_t *lc; > FILE *pfp, *fp; > intmax_t id = -1; >@@ -1226,8 +1227,17 @@ pw_user_add(int argc, char **argv, char *arg1) > homedir = optarg; > break; > case 'e': >- now = time(NULL); >- cmdcnf->expire_days = parse_date(now, optarg); >+ if (genconf) { >+ cmdcnf->expire_days = strtonum(optarg, 1, >+ INT_MAX, &errstr); >+ if (cmdcnf->expire_days < 0 || errstr != NULL) { >+ errx(EX_USAGE, "argument to -e must be " >+ "numeric if -D is specified"); >+ } >+ } else { >+ now = time(NULL); >+ cmdcnf->expire_days = parse_date(now, optarg); >+ } > break; > case 'p': > now = time(NULL);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223431
:
187753
|
187757
|
187758
|
187759
|
187765