~ubuntu-branches/ubuntu/utopic/adduser/utopic

« back to all changes in this revision

Viewing changes to adduser

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-06-25 18:55:03 UTC
  • Revision ID: james.westby@ubuntu.com-20080625185503-byal7tn2wa6tqi0m
Tags: 3.108ubuntu1
* Merge from debian unstable, remaining changes:
  - Allow uppercase letters in the names of system users.
    This is done by having a separate NAME_REGEX_SYSTEM configuration
    setting which applies when --system is specified.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
use Getopt::Long;
37
37
 
38
38
BEGIN {
 
39
    local $ENV{PERL_DL_NONLAZY}=1;
39
40
    eval 'use Locale::gettext';
40
41
    if ($@) {
41
42
        *gettext = sub { shift };
516
517
    create_homedir (1); # copy skeleton data
517
518
 
518
519
    # useradd without -p has left the account disabled (password string is '!')
 
520
    my $yesexpr = langinfo(YESEXPR());
519
521
    if ($ask_passwd) {
520
522
        for (;;) {
521
523
          my $passwd = &which('passwd');
524
526
          system($passwd, $new_name);
525
527
          my $ok = $?>>8;
526
528
          if ($ok != 0) {
527
 
            my $noexpr = langinfo(NOEXPR());
528
529
            my $answer;
529
530
            # hm, error, should we break now?
530
531
            print (gtx("Permission denied\n")) if ($ok == 1);
534
535
            print (gtx("passwd file busy, try again\n")) if ($ok == 5);
535
536
            print (gtx("invalid argument to option\n")) if ($ok == 6);
536
537
            
537
 
            # Translators: [Y/n] has to be replaced by values defined in your
 
538
            # Translators: [y/N] has to be replaced by values defined in your
538
539
            # locale.  You can see by running "locale noexpr" which regular
539
540
            # expression will be checked to find positive answer.
540
 
            print (gtx("Try again? [Y/n] "));
 
541
            print (gtx("Try again? [y/N] "));
541
542
            chop ($answer=<STDIN>);
542
 
            last if ($answer =~ m/$noexpr/o);
 
543
            last if ($answer !~ m/$yesexpr/o);
543
544
          }
544
545
          else {
545
546
            last; ## passwd ok
556
557
        &ch_gecos($new_gecos);
557
558
    }
558
559
    else {
559
 
        my $yesexpr = langinfo(YESEXPR());
 
560
        my $noexpr = langinfo(NOEXPR());
560
561
        for (;;) {
561
562
           my $chfn = &which('chfn');
562
563
            &systemcall($chfn, $new_name);
563
564
            # Translators: [y/N] has to be replaced by values defined in your
564
565
            # locale.  You can see by running "locale yesexpr" which regular
565
566
            # expression will be checked to find positive answer.
566
 
            print (gtx("Is the information correct? [y/N] "));
 
567
            print (gtx("Is the information correct? [Y/n] "));
567
568
            chop (my $answer=<STDIN>);
568
 
            last if ($answer =~ m/$yesexpr/o);
 
569
            last if ($answer !~ m/$noexpr/o);
569
570
        }
570
571
    }
571
572