浏览代码

Oops, forgot a file

Théo Ertzscheid 2 年之前
父节点
当前提交
291951dc83
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      funcs

+ 13 - 0
funcs

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+. .env
+
+user_exists() {
+	res=$(ldapsearch -x -LLL -b $PEOPLEDN -D $BINDDN -w $BINDPW "(&(uid=$1)(objectClass=inetOrgPerson))" | grep uid: | cut -f2 -d' ')
+	[ -n "$res" ]
+}
+
+group_exists() {
+	res=$(ldapsearch -x -LLL -b $GROUPSDN -D $BINDDN -w $BINDPW "(&(cn=$1)(objectClass=groupOfNames))" | grep cn: | cut -f2 -d' ')
+	[ -n "$res" ]
+}