Example #1
0
import os,sys
import subprocess

# log 
import pyLogger
import addLdapUidGid

log = pyLogger.pylogger('ldap_sync','/var/log/nas.log')	
userTbl = addLdapUidGid.userTbl
groupTbl = addLdapUidGid.groupTbl

log.debug("userTbl len=%d"%(len(userTbl)))
log.debug("groupTbl len=%d"%(len(groupTbl)))
"""
re=os.system("/usr/bin/ldaplist -l cn=users  2> /dev/null | egrep \"cn:|uSNCreated:|gidNumber|uidNumber|unixHomeDirectory|loginShell\" > .ldap_tmp")

if re!=0:
	log.error('Execute \'ldaplist -l cn=users\' Fail.')
	print "1"
	os.system("rm -f .ldap_tmp 2> /dev/null")
	sys.exit()

re=os.system("/usr/bin/ldaplist > /dev/null")
if re!=0:
	log.error('Execute \'ldaplist\' Fail.')
	print "1"
	os.system("rm -f .ldap_tmp 2> /dev/null")
	sys.exit()
	
	
f = file(".ldap_tmp", 'r')
Example #2
0
# -*- coding: utf-8 -*-

import sys
import os
import acl
import commands
import re
import string
import pyLogger
log = pyLogger.pylogger('acl','/var/log/aclpy.log')

import pwd
import grp
from stat import * 
import acl_lib

"""

"""		
def doAddACL(name, type, entries,path, acltable):
	#print 'nddame:',name
	log.error("doAddACL in:%s"%name)
	addEntry=[]
	ret=0
	for item in entries:
		if name=='owner@' or name=='group@' or name=='everyone@':
			e='%s:%s'%(name,item)
		else:
			e='%s:%s:%s'%(type,name,item)
		addEntry.append(e)	
	#print 'addEntry:',addEntry
Example #3
0
import sys
import pyLogger
log = pyLogger.pylogger('acl','/var/log/nas_acl.log')

fullACL=[
	 'list_directory',
	 'read_data',
	 'add_file',
	 'write_data',
	 'add_subdirectory',
     'append_data',
	 'read_xattr',
	 'write_xattr',
	 'execute',
	 'delete_child',
     'read_attributes',
	 'write_attributes',
	 'delete',
	 'read_acl',
	 'write_acl',
     'write_owner'
	 ]	 

modACL=[		 
	'list_directory',
	'read_data',
	'add_file',
	'write_data',
	'add_subdirectory',
    'append_data',
	'read_xattr',