summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2010-10-07 11:38:07 +0000
committerMartin Matuska <mm@FreeBSD.org>2010-10-07 11:38:07 +0000
commitde196d323a8a497af5579fdb473dca3ac72730d2 (patch)
treefbdd0a34bde889067d05d3edbce5fa1ef5d47abe /net
parentAttempt to shut down some whining when the resultant script is run. (diff)
smbldap-useradd and smbldap-usermod changes:
- Process only "mail" attribute with -M option - Add separate option -O for "mailLocalAddress" - Expand default domain only for -M (not for -O)
Notes
Notes: svn path=/head/; revision=262556
Diffstat (limited to 'net')
-rw-r--r--net/smbldap-tools/Makefile2
-rw-r--r--net/smbldap-tools/files/patch-smbldap-useradd117
-rw-r--r--net/smbldap-tools/files/patch-smbldap-usermod116
3 files changed, 216 insertions, 19 deletions
diff --git a/net/smbldap-tools/Makefile b/net/smbldap-tools/Makefile
index 6033de72a20a..1abda03de078 100644
--- a/net/smbldap-tools/Makefile
+++ b/net/smbldap-tools/Makefile
@@ -7,7 +7,7 @@
PORTNAME= smbldap-tools
PORTVERSION= 0.9.5
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net
MASTER_SITES= http://download.gna.org/smbldap-tools/packages/ \
http://download.gna.org/smbldap-tools/packages/old-Idealx-release/
diff --git a/net/smbldap-tools/files/patch-smbldap-useradd b/net/smbldap-tools/files/patch-smbldap-useradd
index 1a7f2ea79249..a898147e4f6a 100644
--- a/net/smbldap-tools/files/patch-smbldap-useradd
+++ b/net/smbldap-tools/files/patch-smbldap-useradd
@@ -1,23 +1,30 @@
---- smbldap-useradd.orig 2008-04-22 10:13:29.000000000 +0200
-+++ smbldap-useradd 2010-10-05 12:04:47.827698271 +0200
+--- smbldap-useradd.orig 2010-10-07 13:29:52.246293547 +0200
++++ smbldap-useradd 2010-10-07 13:30:32.544088110 +0200
@@ -35,7 +35,7 @@
my %Options;
my $ok =
- getopts( 'o:abnmwWiPG:u:g:d:s:c:k:t:A:B:C:D:E:F:H:L:M:N:S:T:?', \%Options );
-+ getopts( 'o:abnmwWiPG:u:g:d:s:c:k:t:A:B:C:D:E:F:H:L:M:N:S:T:X:Z?', \%Options );
++ getopts( 'o:abnmwWiPG:u:g:d:s:c:k:t:A:B:C:D:E:F:H:L:M:N:O:S:T:X:Z?', \%Options );
if ( ( !$ok ) || ( @ARGV < 1 ) || ( $Options{'?'} ) ) {
print_banner;
-@@ -74,6 +74,7 @@
+@@ -69,11 +69,13 @@
+ print " -G supplementary comma-separated groups\n";
+ print
+ " -H sambaAcctFlags (samba account control bits like '[NDHTUMWSLKI]')\n";
+- print " -M local mailAddress (comma seperated)\n";
++ print " -M e-mail address (comma seperated)\n";
+ print " -N given name \n";
++ print " -O localMailAddress (comma separated)\n";
print " -P ends by invoking smbldap-passwd\n";
print " -S surname (Family name)\n";
print " -T mailToAddress (forward address) (comma seperated)\n";
-+ print " -X input encoding for givenname and surname (default UTF-8)\n";
++ print " -X input encoding for givenname and surname (default UTF-8)\n";
print " -Z set custom LDAP attributes, name=value pairs comma separated\n";
print " -? show this help message\n";
exit(1);
-@@ -92,6 +93,14 @@
+@@ -92,6 +94,14 @@
# Read only first @ARGV
my $userName = $ARGV[0];
@@ -32,7 +39,15 @@
# For computers account, add a trailing dollar if missing
if ( defined( $Options{'w'} ) or defined( $Options{'W'} ) ) {
if ( $userName =~ /[^\$]$/s ) {
-@@ -278,8 +287,8 @@
+@@ -256,6 +266,7 @@
+
+ my $userHomeDirectory;
+ my ( $givenName, $userCN, $userSN, $displayName );
++my @mail;
+ my @userMailLocal;
+ my @userMailTo;
+ my $tmp;
+@@ -278,8 +289,8 @@
$config{userLoginShell} = $tmp if ( defined( $tmp = $Options{'s'} ) );
$config{userGecos} = $tmp if ( defined( $tmp = $Options{'c'} ) );
$config{skeletonDir} = $tmp if ( defined( $tmp = $Options{'k'} ) );
@@ -43,7 +58,17 @@
if ( $Options{'N'} and $Options{'S'} ) {
$displayName = $userCN = "$givenName" . " $userSN";
}
-@@ -461,7 +470,7 @@
+@@ -287,7 +298,8 @@
+ $displayName = $userCN = $userName;
+ }
+
+-@userMailLocal = &split_arg_comma( $Options{'M'} );
++@mail = &split_arg_comma( $Options{'M'} );
++@userMailLocal = &split_arg_comma( $Options{'O'} );
+ @userMailTo = &split_arg_comma( $Options{'T'} );
+
+ ########################
+@@ -461,7 +473,7 @@
if ( !( -d $userHomeDirectory ) ) {
if ( $config{skeletonDir} ne "" ) {
system
@@ -52,3 +77,79 @@
}
else {
system "mkdir $userHomeDirectory 2>/dev/null";
+@@ -483,31 +495,27 @@
+ }
+ }
+
+-# we start to defined mail adresses if option M or T is given in option
++# we start to defined mail adresses if option M, O or T are given
+ my @adds;
+-if (@userMailLocal) {
+- my @mail;
+- foreach my $m (@userMailLocal) {
++if ( @userMailLocal || @userMailTo ) {
++ push( @adds, 'objectClass' => 'inetLocalMailRecipient' );
++}
++if (@mail) {
++ foreach my $m (@mail) {
+ my $domain = $config{mailDomain};
+- if ( $m =~ /^(.+)@/ ) {
+- push( @mail, $m );
+-
+- # mailLocalAddress contains only the first part
+- $m = $1;
+- }
+- else {
+- push( @mail, $m . ( $domain ? '@' . $domain : '' ) );
++ if ( $m !~ /^(.+)@/ ) {
++ $m = $m . ( $domain ? '@' . $domain : '' );
+ }
+ }
+- push( @adds, 'mailLocalAddress' => [@userMailLocal] );
+ push( @adds, 'mail' => [@mail] );
+ }
++
++if (@userMailLocal) {
++ push( @adds, 'mailLocalAddress' => [@userMailLocal] );
++}
+ if (@userMailTo) {
+ push( @adds, 'mailRoutingAddress' => [@userMailTo] );
+ }
+-if ( @userMailLocal || @userMailTo ) {
+- push( @adds, 'objectClass' => 'inetLocalMailRecipient' );
+-}
+
+ # Custom modification - MPK
+ if ( $Options{'Z'} ) {
+@@ -623,6 +631,9 @@
+ push( @adds, 'sambaLMPassword' => "XXX" );
+ push( @adds, 'sambaNTPassword' => "XXX" );
+ }
++}
++
++if (@adds) {
+ my $modify =
+ $ldap_master->modify( "uid=$userName,$config{usersdn}", add => {@adds} );
+
+@@ -742,16 +753,19 @@
+ spaces and trailing bracket are ignored (samba account control bits like '[NDHTUMWSLKI]'
+
+ -M mail
+- local mail aliases (multiple addresses are seperated by spaces)
++ e-mail adresses (multiple addresses are seperated by commas)
+
+ -N givenname
+ family name. Defaults to username
+
++-O localMailAddress
++ localMailAddresses (multiple addresses are seperated by commas)
++
+ -S surname
+ defaults to username
+
+ -T mailToAddress
+- Forward address (multiple addresses are seperated by spaces)
++ Forward address (multiple addresses are seperated by commas)
+
+ -n
+ do not print banner message
diff --git a/net/smbldap-tools/files/patch-smbldap-usermod b/net/smbldap-tools/files/patch-smbldap-usermod
index f1b1db8a6000..715dec80e045 100644
--- a/net/smbldap-tools/files/patch-smbldap-usermod
+++ b/net/smbldap-tools/files/patch-smbldap-usermod
@@ -1,6 +1,14 @@
---- smbldap-usermod.orig 2008-04-22 10:13:29.000000000 +0200
-+++ smbldap-usermod 2010-10-05 12:05:23.220769671 +0200
-@@ -54,6 +54,7 @@
+--- smbldap-usermod.orig 2010-10-07 13:29:58.221685434 +0200
++++ smbldap-usermod 2010-10-07 13:31:31.821463290 +0200
+@@ -48,12 +48,14 @@
+ "I|sambaDisable" => \$Options{I},
+ "J|sambaEnable" => \$Options{J},
+ "L|shadowLock" => \$Options{L},
+- "M|mailAddresses=s" => \$Options{M},
++ "M|mail=s" => \$Options{M},
+ "N|givenName=s" => \$Options{N},
++ "O|mailLocalAddress=s" => \$Options{O},
+ "P=s" => \$Options{P},
"U|shadowUnlock" => \$Options{U},
"S|surname=s" => \$Options{S},
"T|mailToAddress=s" => \$Options{T},
@@ -8,16 +16,33 @@
"Z|attr=s" => \$Options{Z},
"a|addsambaSAMAccount" => \$Options{a},
"c|gecos=s" => \$Options{c},
-@@ -73,7 +74,7 @@
+@@ -73,7 +75,7 @@
"u|uid=s" => \$Options{u}
);
-#my $ok = getopts('A:B:C:D:E:F:H:IJM:N:S:PT:ame:f:u:g:G:d:l:r:s:c:ok:?h', \%Options);
-+#my $ok = getopts('A:B:C:D:E:F:H:IJM:N:S:PT:X:Z:ame:f:u:g:G:d:l:r:s:c:ok:?h', \%Options);
++#my $ok = getopts('A:B:C:D:E:F:H:IJM:N:O:S:PT:X:Z:ame:f:u:g:G:d:l:r:s:c:ok:?h', \%Options);
if ( ( !$ok ) || ( @ARGV < 1 ) || ( $Options{'h'} ) ) {
print_banner;
-@@ -134,6 +135,8 @@
+@@ -92,11 +94,13 @@
+ print " -N|--givenName <name> given name (first name)\n";
+ print " -S|--surname <suname> surname (family name)\n";
+ print " -P ends by invoking smbldap-passwd\n";
+- print " -M|--mailAddresses <mail,> mailAddresses (comma seperated)\n";
++ print " -M|--mail <mail,> e-mail addresses (comma seperated)\n";
+ print
+-" -T|--mailToAddress <mail,> mailToAddress (forward address) (comma seperated)\n";
++" -O|--mailLocalAddress <mail,> mailLocalAddress (comma separated)\n";
+ print
+-" -e|--expire <date> Sets both shadow and samba expiration date: like \"YYYY-MM-DD(HH:MM:SS)\", or \"yYmMdD\" to extand y year,m months and d days\n";
++" -T|--mailToAddress <mail,> mailToAddress (forward address) (comma separated)\n";
++ print
++" -e|--expire <date> Sets both shadow and samba expiration date: like \"YYYY-MM-DD(HH:MM:SS)\", or \"yYmMdD\" to extend y year,m months and d days\n";
+ print
+ " --shadowExpire <date/n> Shadow expiration date (like \"YYYY-MM-DD\") or 'n' days from today\n";
+ print
+@@ -134,6 +138,8 @@
" -I|--sambaDisable disable an user. Can't be used with -H or -J\n";
print
" -J|--sambaEnable enable an user. Can't be used with -H or -I\n";
@@ -26,7 +51,7 @@
print " -h|--help show this help message\n";
exit(1);
}
-@@ -146,6 +149,14 @@
+@@ -146,6 +152,14 @@
# Read only first @ARGV
my $user = $ARGV[0];
@@ -41,7 +66,7 @@
# Let's connect to the directory first
my $ldap_master = connect_ldap_master();
-@@ -322,11 +333,11 @@
+@@ -322,11 +336,11 @@
# my givenname: Jerome
if ( defined( $tmp = $Options{'N'} ) ) {
@@ -55,7 +80,7 @@
}
my $cn;
-@@ -340,7 +351,7 @@
+@@ -340,7 +354,7 @@
$cn = "$Options{'N'}";
$cn .= " " . $Options{'S'}
unless ( $Options{'S'} eq $Options{'N'} and $Options{'N'} eq $user );
@@ -64,7 +89,78 @@
push( @mods, 'cn' => $push_val );
# set displayName for Samba account
-@@ -841,12 +852,12 @@
+@@ -462,44 +476,53 @@
+ push( @mods, 'userPassword' => $tmp );
+ }
+
+-my $mailobj = 0;
+-if ( $tmp = $Options{'M'} ) {
++if ( $tmp = $Options{'M'} ) {
+
+ # action si + or - for adding or deleting an entry
+ my $action = '';
+ if ( $tmp =~ s/^([+-])+\s*// ) {
+ $action = $1;
+ }
+- my @userMailLocal = &split_arg_comma($tmp);
+- my @mail;
+- foreach my $m (@userMailLocal) {
++ my @mail = &split_arg_comma($tmp);
++ foreach my $m (@mail) {
+ my $domain = $config{mailDomain};
+- if ( $m =~ /^(.+)@/ ) {
+- push( @mail, $m );
+-
+- # mailLocalAddress contains only the first part
+- $m = $1;
+- }
+- else {
+- push( @mail, $m . ( $domain ? '@' . $domain : '' ) );
++ if ( $m !~ /^(.+)@/ ) {
++ $m = $m . ( $domain ? '@' . $domain : '' );
+ }
+ }
+ if ($action) {
+- my @old_MailLocal;
+ my @old_mail;
+ @old_mail = $user_entry->get_value('mail');
++ if ( $action eq '+' ) {
++ @mail = &list_union( \@old_mail, \@mail );
++ }
++ elsif ( $action eq '-' ) {
++ @mail = &list_minus( \@old_mail, \@mail );
++ }
++ }
++ push( @mods, 'mail' => [@mail] );
++}
++
++my $mailobj = 0;
++if ( $tmp = $Options{'O'} ) {
++
++ # action si + or - for adding or deleting an entry
++ my $action = '';
++ if ( $tmp =~ s/^([+-])+\s*// ) {
++ $action = $1;
++ }
++ my @userMailLocal = &split_arg_comma($tmp);
++ if ($action) {
++ my @old_MailLocal;
+ @old_MailLocal = $user_entry->get_value('mailLocalAddress');
+ if ( $action eq '+' ) {
+ @userMailLocal = &list_union( \@old_MailLocal, \@userMailLocal );
+- @mail = &list_union( \@old_mail, \@mail );
+ }
+ elsif ( $action eq '-' ) {
+ @userMailLocal = &list_minus( \@old_MailLocal, \@userMailLocal );
+- @mail = &list_minus( \@old_mail, \@mail );
+ }
+ }
+ push( @mods, 'mailLocalAddress', [@userMailLocal] );
+- push( @mods, 'mail' => [@mail] );
+ $mailobj = 1;
+ }
+
+@@ -841,12 +864,12 @@
# Then assume it has been set correctly with -N and -S before.
push( @mods, "cn" => $new_user )
unless ( $user_entry->get_value("cn")