summaryrefslogtreecommitdiffstats
path: root/pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl
diff options
context:
space:
mode:
authorjmagne <jmagne@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-05-20 21:11:10 +0000
committerjmagne <jmagne@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-05-20 21:11:10 +0000
commitff6c9404a578698ae61a682b3b8df6405dc1e897 (patch)
tree8e90968fc81d44187a9a3c8adffa708047eb3ef8 /pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl
parent668a763104b34dbfbee82f0f3eab73d8c9bd37cf (diff)
downloadpki-ff6c9404a578698ae61a682b3b8df6405dc1e897.tar.gz
pki-ff6c9404a578698ae61a682b3b8df6405dc1e897.tar.xz
pki-ff6c9404a578698ae61a682b3b8df6405dc1e897.zip
Fix bug #491019.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@473 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl')
-rwxr-xr-xpki/base/tps/forms/esc/cgi-bin/sow/cfg.pl41
1 files changed, 41 insertions, 0 deletions
diff --git a/pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl b/pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl
index bbd4863bc..86246d933 100755
--- a/pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl
+++ b/pki/base/tps/forms/esc/cgi-bin/sow/cfg.pl
@@ -141,3 +141,44 @@ sub is_agent()
return 1;
}
}
+
+sub is_user()
+{
+ my ($dn) = @_;
+
+ my $uid = $dn;
+ # need to map a subject dn into user DN
+ $uid =~ /uid=([^,]*)/; # retrieve the uid
+ $uid = $1;
+
+ my $x_host = get_ldap_host();
+ $x_port = get_ldap_port();
+ my $x_basedn = get_base_dn();
+ chomp($x_basedn);
+ my $x_binddn = `grep -e "^tokendb.bindDN" $cfg | cut -c16-`;
+ chomp($x_binddn);
+ my $x_bindpwdpath = `grep -e "^tokendb.bindPassPath" $cfg | cut -c22-`;
+ chomp($x_bindpwdpath);
+ my $x_bindpwd = `grep -e "^tokendbBindPass" $x_bindpwdpath | cut -c17-`;
+ chomp($x_bindpwd);
+
+ my $cmd = $ldapsearch . " " .
+ "-D \"" . $x_binddn . "\" " .
+ "-w \"" . $x_bindpwd . "\" " .
+ "-b \"" . "ou=people,".$x_basedn . "\" " .
+ "-h \"" . $x_host . "\" " .
+ "-p \"" . $x_port ."\" " .
+ "-1 \"(uid=" . $uid . "*)\" | wc -l";
+
+
+ my $matched = `$cmd`;
+
+ chomp($matched);
+
+ if ($matched eq "0" || $matched eq "") {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+