- Timestamp:
- 10/22/09 11:07:40 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/linuxmuster-base/trunk/share/scripts/helperfunctions.sh
r497 r549 660 660 RET=`psql -U ldap -d ldap -t -c "select uid from posix_account where firstname = 'Exam';"` 661 661 if [ -n "$RET" ]; then 662 echo "$RET"663 return 0664 else 665 return 1662 echo "$RET" | awk '{ print $1 }' 663 return 0 664 else 665 return 1 666 666 fi 667 667 } … … 670 670 hosts_ldap() { 671 671 unset RET 672 RET=`ldapsearch - c -LL -b ou=accounts,$basedn -x filter cn=ExamAccount | grep uid= | awk -F= '{ print $2 }' | awk -F, '{ print $1}'`672 RET=`ldapsearch -x -ZZ -h localhost "(cn=ExamAccount)" | grep ^uid\: | awk '{ print $2 }'` 673 673 if [ -n "$RET" ]; then 674 674 echo "$RET" … … 684 684 RET=`psql -U ldap -d ldap -t -c "select uid from posix_account where firstname = 'Computer';"` 685 685 if [ -n "$RET" ]; then 686 echo "$RET" | awk '{ print $1 }' 687 return 0 688 else 689 return 1 690 fi 691 } 692 693 # get all host accounts from ldap 694 machines_ldap() { 695 unset RET 696 RET=`ldapsearch -x -ZZ -h localhost "(cn=Computer)" | grep ^uid\: | awk '{ print $2 }'` 697 if [ -n "$RET" ]; then 686 698 echo "$RET" 687 699 return 0 … … 691 703 } 692 704 693 # get all host accounts from ldap 694 machines_ldap() { 695 unset RET 696 RET=`ldapsearch -c -LL -b ou=machines,$basedn -x filter cn=Computer | grep uid= | awk -F= '{ print $2 }' | awk -F, '{ print $1 }'` 705 # get all user accounts 706 accounts_db() { 707 unset RET 708 RET=`psql -U ldap -d ldap -t -c "select uid from posix_account where firstname <> 'Computer' and firstname <> 'Exam';"` 709 if [ -n "$RET" ]; then 710 echo "$RET" | awk '{ print $1 }' 711 return 0 712 else 713 return 1 714 fi 715 } 716 717 # get all user accounts from ldap 718 accounts_ldap() { 719 unset RET 720 RET=`ldapsearch -x -ZZ -h localhost "(&(!(cn=Computer))(!(cn=ExamAccount)))" | grep ^uid\: | awk '{ print $2 }'` 697 721 if [ -n "$RET" ]; then 698 722 echo "$RET"
Note: See TracChangeset
for help on using the changeset viewer.
