aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2010-10-13 17:06:40 +0800
committermm <mm@FreeBSD.org>2010-10-13 17:06:40 +0800
commit85012571cee70bc0c5bf3da743b291b913d36b4e (patch)
treec3d6c6db6b4790ce25ecd574c6a4b554b71ea13c /net
parentaa304be65eb8f5d316293a7b85621ad126845dd6 (diff)
downloadfreebsd-ports-gnome-85012571cee70bc0c5bf3da743b291b913d36b4e.tar.gz
freebsd-ports-gnome-85012571cee70bc0c5bf3da743b291b913d36b4e.tar.zst
freebsd-ports-gnome-85012571cee70bc0c5bf3da743b291b913d36b4e.zip
- Simplify Makefile
- Add smbldap-grouplist script
Diffstat (limited to 'net')
-rw-r--r--net/smbldap-tools/Makefile26
-rw-r--r--net/smbldap-tools/files/patch-smbldap-grouplist206
-rw-r--r--net/smbldap-tools/files/patch-smbldap_tools.pm31
-rw-r--r--net/smbldap-tools/pkg-plist1
4 files changed, 252 insertions, 12 deletions
diff --git a/net/smbldap-tools/Makefile b/net/smbldap-tools/Makefile
index 1abda03de078..5c978de9ad30 100644
--- a/net/smbldap-tools/Makefile
+++ b/net/smbldap-tools/Makefile
@@ -7,7 +7,7 @@
PORTNAME= smbldap-tools
PORTVERSION= 0.9.5
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= net
MASTER_SITES= http://download.gna.org/smbldap-tools/packages/ \
http://download.gna.org/smbldap-tools/packages/old-Idealx-release/
@@ -33,6 +33,20 @@ PORTEXAMPLES= *
OPTIONS= MIGRATION_SCRIPTS "Install migration scripts" off \
PDF_DOC "Install PDF documentation" off
+SMBLDAP_TOOLS= smbldap-groupadd \
+ smbldap-groupdel \
+ smbldap-grouplist \
+ smbldap-groupmod \
+ smbldap-groupshow \
+ smbldap-useradd \
+ smbldap-userdel \
+ smbldap-userinfo \
+ smbldap-userlist \
+ smbldap-usermod \
+ smbldap-usershow \
+ smbldap-passwd \
+ smbldap-populate
+
.include <bsd.port.pre.mk>
.if defined(WITH_MIGRATION_SCRIPTS)
@@ -48,10 +62,7 @@ post-patch:
${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 \
+.for i in smbldap_tools.pm ${SMBLDAP_TOOLS} \
doc/migration_scripts/smbldap-migrate-pwdump-groups \
doc/migration_scripts/smbldap-migrate-unix-accounts \
doc/migration_scripts/smbldap-migrate-unix-groups \
@@ -68,10 +79,7 @@ do-install:
${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
+.for i in ${SMBLDAP_TOOLS}
${INSTALL_SCRIPT} ${WRKSRC}/$i ${PREFIX}/sbin
.endfor
${INSTALL_DATA} ${WRKSRC}/smbldap_tools.pm ${SITE_PERL}/
diff --git a/net/smbldap-tools/files/patch-smbldap-grouplist b/net/smbldap-tools/files/patch-smbldap-grouplist
new file mode 100644
index 000000000000..5e951af79a97
--- /dev/null
+++ b/net/smbldap-tools/files/patch-smbldap-grouplist
@@ -0,0 +1,206 @@
+--- smbldap-grouplist.orig 2010-10-13 10:51:05.808787252 +0200
++++ smbldap-grouplist 2010-10-13 10:50:57.535195866 +0200
+@@ -0,0 +1,203 @@
++#!/usr/bin/perl -w
++
++# This code was developped by Jerome Tournier (jtournier@gmail.com) and
++# contributors (their names can be found in the CONTRIBUTORS file).
++
++# This was first created by tarjei Huse <tarjei@nu.no>
++
++# This program is free software; you can redistribute it and/or
++# modify it under the terms of the GNU General Public License
++# as published by the Free Software Foundation; either version 2
++# of the License, or (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
++
++# Purpose of smbldap-grouplist : list groups
++
++use strict;
++use Getopt::Std;
++use FindBin;
++use FindBin qw($RealBin);
++use lib "$RealBin/";
++use smbldap_tools;
++#use Date::Format;
++
++# function declaration
++sub exist_in_tab;
++
++my %Options;
++
++my $ok = getopts('dtS?', \%Options);
++if ( (!$ok) || ($Options{'?'}) || $Options{'h'} ) {
++ print "Usage: $0 [options] [user template]\n\n";
++ print "Available UNIX options are:\n";
++ print "-d Show displayName\n";
++ print "-t Show samba group type\n";
++ print "-S Show samba SID\n";
++ print "-? show the help message\n";
++ exit (1);
++}
++
++my $binduser;
++my $pass;
++
++if (!defined($binduser)) {
++ $binduser = getpwuid($<);
++}
++
++my $search;
++if ( $ARGV[0] ) {
++ if ( $< != 0 ) {
++ die "Only root can show group inormation\n";
++ } else {
++ $search=$ARGV[0];
++ }
++} elsif ( $< != 0 ) {
++ $search=$binduser;
++}
++
++
++my ($dn,$ldap_master);
++# First, connecting to the directory
++if ($< != 0) {
++ # non-root user
++ if (!defined($pass)) {
++ # prompt for password
++ print "UNIX password: ";
++system "stty -echo" if (-t STDIN);
++chomp($pass=<STDIN>);
++system "stty echo" if (-t STDIN);
++print "\n";
++
++# JTO: search real basedn: may be different in case ou=bla1,ou=bla2 !
++# JTO: faire afficher egalement lock, expire et lastChange
++$config{masterDN}="uid=$binduser,$config{usersdn}";
++$config{masterPw}="$pass";
++$ldap_master=connect_ldap_master();
++$dn=$config{masterDN};
++if (!is_user_valid($binduser, $dn, $pass)) {
++ print "Authentication failure\n";
++ exit (10);
++}
++}
++} else {
++ # root user
++ $ldap_master=connect_ldap_master();
++# test existence of user in LDAP
++my $dn_line;
++}
++
++sub print_group {
++ my ($entry, %Options) = @_;
++ printf "%4s ", $entry->get_value('gidNumber') ;
++ printf "|%-20s ", $entry->get_value('cn');
++ if ($Options{'d'})
++ {
++ if (defined $entry->get_value('displayName'))
++ {
++ printf "|%-20s", $entry->get_value('displayName');
++ } else {
++ print "|-";
++ }
++ }
++ if ($Options{'t'})
++ {
++ my $group_name;
++ if (defined($entry->get_value('sambaGroupType')) && \
++ defined($group_name = &group_name_by_type($entry->get_value('sambaGroupType'))))
++ {
++ printf "|%-14s", $group_name;
++ } else {
++ print "|-";
++ }
++ }
++ if ($Options{'S'})
++ {
++ if (defined $entry->get_value('sambaSID'))
++ {
++ printf "|%-47s", $entry->get_value('sambaSID');
++ } else {
++ print "|-";
++ }
++ }
++ print "|\n";
++}
++
++my $attrs="['gid','cn'";
++my $banner="gid |cn ";
++if ($Options{'d'})
++{
++ $banner .= "|displayName ";
++ $attrs .= ",'displayName'";
++}
++if ($Options{'t'})
++{
++ $banner .= "|sambaGroupType";
++ $attrs .= ",'sambaGroupType'";
++}
++if ($Options{'S'})
++{
++ $banner .= "|sambaSID ";
++ $attrs .= ",'sambaSID'";
++}
++$attrs.="]";
++$banner.="|";
++print "$banner\n\n";
++my $filter;
++$filter = "(&(objectclass=posixGroup)";
++my $base = $config{groupsdn};
++
++if ($search) {
++ $filter.="(displayName=$search)";
++}
++
++$filter.=")";
++
++my $mesg = $ldap_master->search ( base => $base,
++ scope => $config{scope},
++ filter => $filter,
++ attrs => "$attrs"
++ );
++$mesg->code && warn $mesg->error;
++
++foreach my $entry ($mesg->all_entries) {
++ print_group($entry,%Options);
++}
++########################################
++
++=head1 NAME
++
++smbldap-grouplist list groups
++
++=head1 SYNOPSIS
++
++smbldap-grouplist [-S] [group template]
++
++
++=head1 DESCRIPTION
++
++-d Show displayName
++
++-S Show samba SID entry
++
++-? show the help message
++
++=head1 EXAMPLE
++
++smbldap-grouplist -dS
++
++smbldap-grouplist "*ourn*"
++
++=cut
++
++#'
++
++# The End
diff --git a/net/smbldap-tools/files/patch-smbldap_tools.pm b/net/smbldap-tools/files/patch-smbldap_tools.pm
index f05d6a6225c3..73c1d238a9db 100644
--- a/net/smbldap-tools/files/patch-smbldap_tools.pm
+++ b/net/smbldap-tools/files/patch-smbldap_tools.pm
@@ -1,6 +1,14 @@
--- smbldap_tools.pm.orig 2008-04-22 10:13:29.000000000 +0200
-+++ smbldap_tools.pm 2010-10-05 12:53:27.592346981 +0200
-@@ -825,9 +825,9 @@
++++ smbldap_tools.pm 2010-10-13 10:50:48.831761476 +0200
+@@ -92,6 +92,7 @@
+ get_user_dn2
+ connect_ldap_master
+ connect_ldap_slave
++ group_name_by_type
+ group_type_by_name
+ subst_configvar
+ read_config
+@@ -825,9 +826,9 @@
$lines .= "dn: " . $entry->dn . "\n";
foreach my $attr ( $entry->attributes ) {
my @vals = $entry->get_value($attr);
@@ -13,7 +21,24 @@
$lines .= $attr . ": " . join( ',', @vals ) . "\n";
}
}
-@@ -1209,22 +1209,33 @@
+@@ -1109,6 +1110,16 @@
+ return $groupmap{$type_name};
+ }
+
++sub group_name_by_type {
++ my $groupmap = shift;
++ my %type_name = (
++ 2 => 'domain',
++ 4 => 'local',
++ 5 => 'builtin'
++ );
++ return $type_name{$groupmap};
++}
++
+ sub subst_user {
+ my ( $str, $username ) = @_;
+ $str =~ s/%U/$username/ if ($str);
+@@ -1209,22 +1220,33 @@
}
sub utf8Encode {
diff --git a/net/smbldap-tools/pkg-plist b/net/smbldap-tools/pkg-plist
index ef1134b7538b..33671a38ee87 100644
--- a/net/smbldap-tools/pkg-plist
+++ b/net/smbldap-tools/pkg-plist
@@ -1,5 +1,6 @@
sbin/smbldap-groupadd
sbin/smbldap-groupdel
+sbin/smbldap-grouplist
sbin/smbldap-groupmod
sbin/smbldap-groupshow
%%MIGRATION_SCRIPTS%%sbin/smbldap-migrate-pwdump-groups