summaryrefslogtreecommitdiffstats
path: root/sc-ap/ldapuser.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-26 10:35:25 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-26 10:35:25 -0500
commit6610cd15cf186fe1f8e82628f6f12aa2c490bac2 (patch)
treeb90a0c31fdb5bdb33a0711b1f28ab26d0ef735d1 /sc-ap/ldapuser.cpp
downloadwindows-ldap-integration-6610cd15cf186fe1f8e82628f6f12aa2c490bac2.tar.gz
windows-ldap-integration-6610cd15cf186fe1f8e82628f6f12aa2c490bac2.zip
Initial import of abandoned sc-ap project
Diffstat (limited to 'sc-ap/ldapuser.cpp')
-rwxr-xr-xsc-ap/ldapuser.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/sc-ap/ldapuser.cpp b/sc-ap/ldapuser.cpp
new file mode 100755
index 0000000..062efd3
--- /dev/null
+++ b/sc-ap/ldapuser.cpp
@@ -0,0 +1,51 @@
+#include "ldapuser.h"
+
+mystring LDAPUser::getGidByUserName( const mystring &userName) {
+
+ mystring filter = L"(&(uid=";
+ filter.append( userName);
+ filter.append( L")(objectClass=posixAccount))");
+
+ return queryAttr( filter, L"gidNumber");
+}
+
+
+mystring
+LDAPUser::getGroupByGid( const mystring& gid) {
+ mystring filter = L"(&(gidNumber=" + gid + L")(objectClass=posixGroup))";
+ mystring result = queryAttr( filter, L"cn");
+ if (result == L"") {
+ return gid;
+ }
+ return result;
+}
+
+stringSet
+LDAPUser::getGroupsByUserName( const mystring& user, const mystring& gid) {
+ mystring filter = L"(&(|(gidNumber=" + gid + L")(memberUid=" + user + L"))(objectClass=posixGroup))";
+ stringSet list1 = queryListOfAttr( filter, L"cn");
+
+ return list1;
+}
+
+stringSet
+LDAPUser::getUserNames() {
+ mystring filter = L"(objectClass=posixAccount)";
+ return queryListOfAttr( filter, L"uid");
+}
+
+stringSet
+LDAPUser::getGroupNames() {
+ mystring filter = L"(objectClass=posixGroup)";
+ return queryListOfAttr( filter, L"cn");
+}
+
+stringMap
+LDAPUser::getAttribsByUserName( const mystring &userName, const stringSet attribs) {
+
+ mystring filter = L"(&(uid=";
+ filter.append( userName);
+ filter.append( L")(objectClass=posixAccount))");
+
+ return querySetOfAttrs( filter, attribs);
+}