Index: head/net/smbldap-tools/Makefile =================================================================== --- head/net/smbldap-tools/Makefile (revision 262555) +++ head/net/smbldap-tools/Makefile (revision 262556) @@ -1,106 +1,106 @@ # New ports collection makefile for: smbldap-tools # Date created: May 8 2004 # Whom: Florent Thoumie # # $FreeBSD$ # 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/ EXTRACT_SUFX= .tgz MAINTAINER= mm@FreeBSD.org COMMENT= Samba-LDAP management and support tools BUILD_DEPENDS= ${SITE_PERL}/Net/LDAP.pm:${PORTSDIR}/net/p5-perl-ldap \ ${SITE_PERL}/Crypt/SmbHash.pm:${PORTSDIR}/security/p5-Crypt-SmbHash \ ${SITE_PERL}/${PERL_ARCH}/Digest/SHA1.pm:${PORTSDIR}/security/p5-Digest-SHA1 \ ${SITE_PERL}/${PERL_ARCH}/Unicode/Map8.pm:${PORTSDIR}/converters/p5-Unicode-MapUTF8 RUN_DEPENDS= ${BUILD_DEPENDS} WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:C/a//} USE_PERL5= yes NO_BUILD= yes PORTDOCS= * PORTEXAMPLES= * OPTIONS= MIGRATION_SCRIPTS "Install migration scripts" off \ PDF_DOC "Install PDF documentation" off .include .if defined(WITH_MIGRATION_SCRIPTS) PLIST_SUB+= MIGRATION_SCRIPTS="" .else PLIST_SUB+= MIGRATION_SCRIPTS="@comment " .endif post-patch: @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ -e "s|/etc/samba|${PREFIX}/etc|g" \ -e "s|/etc/smb/|${PREFIX}/etc/smb/|g" \ ${WRKSRC}/configure.pl \ ${WRKSRC}/doc/smb.conf \ ${WRKSRC}/smbldap_tools.pm .for i in smbldap_tools.pm smbldap-groupadd smbldap-groupdel smbldap-groupmod \ smbldap-groupshow smbldap-useradd smbldap-userdel smbldap-userinfo \ smbldap-userlist smbldap-usermod smbldap-usershow smbldap-passwd \ smbldap-populate \ doc/migration_scripts/smbldap-migrate-pwdump-groups \ doc/migration_scripts/smbldap-migrate-unix-accounts \ doc/migration_scripts/smbldap-migrate-unix-groups \ doc/migration_scripts/smbldap-migrate-pwdump-accounts @${REINPLACE_CMD} -e "s|/usr/bin/perl|${PERL}|g" \ -e "s|/usr/sbin|${LOCALBASE}/sbin|g" \ -e "s|/etc/opt/IDEALX|${PREFIX}/etc|g" \ ${WRKSRC}/$i .endfor do-install: ${MKDIR} ${PREFIX}/etc/smbldap-tools .for i in smbldap.conf smbldap_bind.conf ${INSTALL_DATA} ${WRKSRC}/$i ${PREFIX}/etc/smbldap-tools/$i.sample @[ -f ${PREFIX}/etc/smbldap-tools/$i ] || ${INSTALL_DATA} ${WRKSRC}/$i ${PREFIX}/etc/smbldap-tools/$i .endfor .for i in smbldap-groupadd smbldap-groupdel smbldap-groupmod \ smbldap-groupshow smbldap-useradd smbldap-userdel smbldap-userinfo \ smbldap-userlist smbldap-usermod smbldap-usershow smbldap-passwd \ smbldap-populate ${INSTALL_SCRIPT} ${WRKSRC}/$i ${PREFIX}/sbin .endfor ${INSTALL_DATA} ${WRKSRC}/smbldap_tools.pm ${SITE_PERL}/ .if !defined(NOPORTEXAMPLES) ${MKDIR} ${EXAMPLESDIR} ${INSTALL_DATA} ${WRKSRC}/doc/smb.conf ${EXAMPLESDIR}/ ${INSTALL_DATA} ${WRKSRC}/doc/slapd.conf ${EXAMPLESDIR}/ ${INSTALL_SCRIPT} ${WRKSRC}/configure.pl ${EXAMPLESDIR}/ .endif .if defined(WITH_MIGRATION_SCRIPTS) ${MKDIR} ${DOCSDIR}/migration_scripts .for i in smbldap-migrate-pwdump-accounts smbldap-migrate-pwdump-groups \ smbldap-migrate-unix-accounts smbldap-migrate-unix-groups ${INSTALL_SCRIPT} ${WRKSRC}/doc/migration_scripts/$i ${PREFIX}/sbin .endfor .endif post-install: .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} .for file in CONTRIBUTORS COPYING ChangeLog FILES INFRA INSTALL README TODO ${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}/ .endfor ${INSTALL_DATA} ${WRKSRC}/doc/smbldap-tools.html ${DOCSDIR}/smbldap-tools.html .if defined(WITH_PDF_DOC) ${INSTALL_DATA} ${WRKSRC}/doc/smbldap-tools.pdf ${DOCSDIR}/smbldap-tools.pdf .endif .endif .include Property changes on: head/net/smbldap-tools/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.24 \ No newline at end of property +1.25 \ No newline at end of property Index: head/net/smbldap-tools/files/patch-smbldap-useradd =================================================================== --- head/net/smbldap-tools/files/patch-smbldap-useradd (revision 262555) +++ head/net/smbldap-tools/files/patch-smbldap-useradd (revision 262556) @@ -1,54 +1,155 @@ ---- 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]; +# Get the input encoding +my $characterSet; +if ( defined( $Options{'X'} ) ) { + $characterSet = $Options{'X'}; +} else { + $characterSet = "UTF-8"; +} + # 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'} ) ); -$givenName = ( utf8Encode( $Options{'N'} ) || $userName ); -$userSN = ( utf8Encode( $Options{'S'} ) || $userName ); +$givenName = ( utf8Encode( $characterSet, $Options{'N'} ) || $userName ); +$userSN = ( utf8Encode( $characterSet, $Options{'S'} ) || $userName ); 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 - "cp -r $config{skeletonDir} $userHomeDirectory 2>/dev/null"; + "cp -pRP $config{skeletonDir} $userHomeDirectory 2>/dev/null"; } 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 Property changes on: head/net/smbldap-tools/files/patch-smbldap-useradd ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.3 \ No newline at end of property +1.4 \ No newline at end of property Index: head/net/smbldap-tools/files/patch-smbldap-usermod =================================================================== --- head/net/smbldap-tools/files/patch-smbldap-usermod (revision 262555) +++ head/net/smbldap-tools/files/patch-smbldap-usermod (revision 262556) @@ -1,81 +1,177 @@ ---- 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}, + "X|inputEncoding=s" => \$Options{X}, "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 given name (first name)\n"; + print " -S|--surname surname (family name)\n"; + print " -P ends by invoking smbldap-passwd\n"; +- print " -M|--mailAddresses mailAddresses (comma seperated)\n"; ++ print " -M|--mail e-mail addresses (comma seperated)\n"; + print +-" -T|--mailToAddress mailToAddress (forward address) (comma seperated)\n"; ++" -O|--mailLocalAddress mailLocalAddress (comma separated)\n"; + print +-" -e|--expire 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 mailToAddress (forward address) (comma separated)\n"; ++ print ++" -e|--expire 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 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"; + print +" -X|--inputEncoding input encoding for givenname and surname (defaults to UTF-8)\n"; 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]; +# Get the input encoding +my $characterSet; +if ( defined( $Options{'X'} ) ) { + $characterSet = $Options{'X'}; +} else { + $characterSet = "UTF-8"; +} + # 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'} ) ) { - push( @mods, 'givenName' => utf8Encode($tmp) ); + push( @mods, 'givenName' => utf8Encode($characterSet,$tmp) ); } if ( defined( $tmp = $Options{'S'} ) ) { - push( @mods, 'sn' => utf8Encode($tmp) ); + push( @mods, 'sn' => utf8Encode($characterSet,$tmp) ); } 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 ); - my $push_val = utf8Encode($cn); + my $push_val = utf8Encode($characterSet,$cn); 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") - and $user_entry->get_value("cn") ne utf8Encode($user) + and $user_entry->get_value("cn") ne utf8Encode($characterSet,$user) or $Options{'N'} and $Options{'S'} ); push( @mods, "displayName" => $new_user ) unless ( not $samba or $user_entry->get_value("displayName") - and $user_entry->get_value("displayName") ne utf8Encode($user) + and $user_entry->get_value("displayName") ne utf8Encode($characterSet,$user) or $Options{'N'} and $Options{'S'} ); if ( @mods > 0 ) { # only change if there is something to change Property changes on: head/net/smbldap-tools/files/patch-smbldap-usermod ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.3 \ No newline at end of property +1.4 \ No newline at end of property