projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add username-letter and username-letterfirst config files
[freeside.git]
/
FS
/
FS
/
svc_acct.pm
diff --git
a/FS/FS/svc_acct.pm
b/FS/FS/svc_acct.pm
index
93b657f
..
0e0c885
100644
(file)
--- a/
FS/FS/svc_acct.pm
+++ b/
FS/FS/svc_acct.pm
@@
-2,14
+2,14
@@
package FS::svc_acct;
use strict;
use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin
use strict;
use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin
- $usernamemax $passwordmin
+ $usernamemax $passwordmin
$username_letter $username_letterfirst
$shellmachine $useradd $usermod $userdel
@saltset @pw_set);
use Carp;
use FS::Conf;
$shellmachine $useradd $usermod $userdel
@saltset @pw_set);
use Carp;
use FS::Conf;
-use FS::Record qw( qsearchs fields );
+use FS::Record qw( qsearch
qsearch
s fields );
use FS::svc_Common;
use FS::svc_Common;
-use
FS
::SSH qw(ssh);
+use
Net
::SSH qw(ssh);
use FS::part_svc;
use FS::svc_acct_pop;
use FS::svc_acct_sm;
use FS::part_svc;
use FS::svc_acct_pop;
use FS::svc_acct_sm;
@@
-46,6
+46,8
@@
$FS::UID::callback{'FS::svc_acct'} = sub {
'rm -rf $old_dir'.
')';
}
'rm -rf $old_dir'.
')';
}
+ $username_letter = $conf->exists('username-letter');
+ $username_letterfirst = $conf->exists('username-letterfirst');
};
@saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
};
@saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
@@
-170,7
+172,7
@@
sub insert {
if qsearchs( 'svc_acct', { 'username' => $self->username } );
my $part_svc = qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
if qsearchs( 'svc_acct', { 'username' => $self->username } );
my $part_svc = qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
- return "Unk
on
wn svcpart" unless $part_svc;
+ return "Unk
no
wn svcpart" unless $part_svc;
return "uid in use"
if $part_svc->svc_acct__uid_flag ne 'F'
&& qsearchs( 'svc_acct', { 'uid' => $self->uid } )
return "uid in use"
if $part_svc->svc_acct__uid_flag ne 'F'
&& qsearchs( 'svc_acct', { 'uid' => $self->uid } )
@@
-188,7
+190,7
@@
sub insert {
$self->shell,
);
if ( $username && $uid && $dir && $shellmachine && ! $nossh_hack ) {
$self->shell,
);
if ( $username && $uid && $dir && $shellmachine && ! $nossh_hack ) {
- ssh("root\@$shellmachine", eval
"$useradd"
);
+ ssh("root\@$shellmachine", eval
qq("$useradd")
);
}
''; #no error
}
''; #no error
@@
-242,7
+244,7
@@
sub delete {
$self->dir,
);
if ( $username && $shellmachine && ! $nossh_hack ) {
$self->dir,
);
if ( $username && $shellmachine && ! $nossh_hack ) {
- ssh("root\@$shellmachine", eval
"$userdel"
);
+ ssh("root\@$shellmachine", eval
qq("$userdel")
);
}
'';
}
'';
@@
-304,7
+306,7
@@
sub replace {
$new->getfield('gid'),
);
if ( $old_dir && $new_dir && $old_dir ne $new_dir && ! $nossh_hack ) {
$new->getfield('gid'),
);
if ( $old_dir && $new_dir && $old_dir ne $new_dir && ! $nossh_hack ) {
- ssh("root\@$shellmachine", eval
"$usermod"
);
+ ssh("root\@$shellmachine", eval
qq("$usermod")
);
}
''; #no error
}
''; #no error
@@
-381,11
+383,15
@@
sub check {
$recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
or return "Illegal username";
$recref->{username} = $1;
$recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
or return "Illegal username";
$recref->{username} = $1;
- $recref->{username} =~ /[a-z]/ or return "Illegal username";
+ if ( $username_letterfirst ) {
+ $recref->{username} =~ /^[a-z]/ or return "Illegal username";
+ } elsif ( $username_letter ) {
+ $recref->{username} =~ /[a-z]/ or return "Illegal username";
+ }
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
- return "Unk
on
wn popnum" unless
+ return "Unk
no
wn popnum" unless
! $recref->{popnum} ||
qsearchs('svc_acct_pop',{'popnum'=> $recref->{popnum} } );
! $recref->{popnum} ||
qsearchs('svc_acct_pop',{'popnum'=> $recref->{popnum} } );
@@
-536,7
+542,7
@@
sub radius_check {
=head1 VERSION
=head1 VERSION
-$Id: svc_acct.pm,v 1.1
2 2000-07-17 10:53:42
ivan Exp $
+$Id: svc_acct.pm,v 1.1
7 2001-06-03 12:36:10
ivan Exp $
=head1 BUGS
=head1 BUGS
@@
-552,7
+558,7
@@
counterintuitive.
=head1 SEE ALSO
L<FS::svc_Common>, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>,
=head1 SEE ALSO
L<FS::svc_Common>, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>,
-L<FS::part_svc>, L<FS::cust_pkg>, L<
FS
::SSH>, L<ssh>, L<FS::svc_acct_pop>,
+L<FS::part_svc>, L<FS::cust_pkg>, L<
Net
::SSH>, L<ssh>, L<FS::svc_acct_pop>,
schema.html from the base documentation.
=cut
schema.html from the base documentation.
=cut