# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import common import constants import search attmap = common.Attributes(cn='cn', ipHostNumber='ipHostNumber') filter = '(objectClass=ipHost)' class Search(search.LDAPSearch): canonical_first = ('cn', ) required = ('cn', ) class Cache(cache.Cache): tables = ('host_cache', 'host_alias_cache', 'host_address_cache') create_sql = ''' CREATE TABLE IF NOT EXISTS `host_cache`
# # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import datetime import cache import common import constants import search attmap = common.Attributes(cn='cn', ipServicePort='ipServicePort', ipServiceProtocol='ipServiceProtocol') filter = '(objectClass=ipService)' class Search(search.LDAPSearch): case_sensitive = ('cn', 'ipServiceProtocol') limit_attributes = ('ipServiceProtocol', ) canonical_first = ('cn', ) required = ('cn', 'ipServicePort', 'ipServiceProtocol') class Cache(cache.Cache): tables = ('service_cache', 'service_alias_cache')
# You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import cfg import common import constants import search attmap = common.Attributes(uid='uid', userPassword='******', shadowLastChange='"${shadowLastChange:--1}"', shadowMin='"${shadowMin:--1}"', shadowMax='"${shadowMax:--1}"', shadowWarning='"${shadowWarning:--1}"', shadowInactive='"${shadowInactive:--1}"', shadowExpire='"${shadowExpire:--1}"', shadowFlag='"${shadowFlag:-0}"') filter = '(objectClass=shadowAccount)' class Search(search.LDAPSearch): case_sensitive = ('uid', ) limit_attributes = ('uid', ) required = ('uid', ) class Cache(cache.Cache):
# License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import logging import cache import cfg import common import constants import search attmap = common.Attributes(uid='uid', userPassword='******', uidNumber='uidNumber', gidNumber='gidNumber', gecos='"${gecos:-$cn}"', homeDirectory='homeDirectory', loginShell='loginShell', objectClass='objectClass') filter = '(objectClass=posixAccount)' class Search(search.LDAPSearch): case_sensitive = ('uid', 'uidNumber') limit_attributes = ('uid', 'uidNumber') required = ('uid', 'uidNumber', 'gidNumber', 'gecos', 'homeDirectory', 'loginShell') def mk_filter(self): if 'uidNumber' in self.parameters:
# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import common import constants import search attmap = common.Attributes(cn='cn', ipProtocolNumber='ipProtocolNumber') filter = '(objectClass=ipProtocol)' class Search(search.LDAPSearch): case_sensitive = ('cn', ) canonical_first = ('cn', ) required = ('cn', 'ipProtocolNumber') class Cache(cache.Cache): tables = ('protocol_cache', 'protocol_alias_cache') create_sql = '''
# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import common import constants import search attmap = common.Attributes(cn='cn', ipNetworkNumber='ipNetworkNumber') filter = '(objectClass=ipNetwork)' class Search(search.LDAPSearch): canonical_first = ('cn', ) required = ('cn', ) class Cache(cache.Cache): tables = ('network_cache', 'network_alias_cache', 'network_address_cache') create_sql = ''' CREATE TABLE IF NOT EXISTS `network_cache`
# License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import re import cache import common import constants import search _netgroup_triple_re = re.compile( r'^\s*\(\s*(?P<host>.*)\s*,\s*(?P<user>.*)\s*,\s*(?P<domain>.*)\s*\)\s*$') attmap = common.Attributes(cn='cn', nisNetgroupTriple='nisNetgroupTriple', memberNisNetgroup='memberNisNetgroup') filter = '(objectClass=nisNetgroup)' class Search(search.LDAPSearch): case_sensitive = ('cn', ) required = ('cn', ) class Cache(cache.Cache): tables = ('netgroup_cache', 'netgroup_triple_cache', 'netgroup_member_cache')
import cfg import common import constants import passwd import search def clean(lst): if lst: for i in lst: yield i.replace('\0', '') attmap = common.Attributes(cn='cn', userPassword='******', gidNumber='gidNumber', memberUid='memberUid', member='member') filter = '(objectClass=posixGroup)' class Search(search.LDAPSearch): case_sensitive = ('cn', ) limit_attributes = ('cn', 'gidNumber') def __init__(self, *args, **kwargs): super(Search, self).__init__(*args, **kwargs) if (cfg.nss_getgrent_skipmembers or 'memberUid' in self.parameters or 'member' in self.parameters): # set up our own attributes that leave out membership attributes
# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import common import constants import search attmap = common.Attributes(cn='cn', rfc822MailMember='rfc822MailMember') filter = '(objectClass=nisMailAlias)' class Search(search.LDAPSearch): case_insensitive = ('cn', ) limit_attributes = ('cn', ) required = ('cn', 'rfc822MailMember') class Cache(cache.Cache): tables = ('alias_cache', 'alias_member_cache') create_sql = '''
# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import cache import common import constants import search attmap = common.Attributes(cn='cn', oncRpcNumber='oncRpcNumber') filter = '(objectClass=oncRpc)' class Search(search.LDAPSearch): case_sensitive = ('cn', ) canonical_first = ('cn', ) required = ('cn', 'oncRpcNumber') class Cache(cache.Cache): tables = ('rpc_cache', 'rpc_alias_cache') create_sql = '''
import constants import search def ether_aton(ether): """Converst an ethernet address to binary form in network byte order.""" return struct.pack('BBBBBB', *(int(x, 16) for x in ether.split(':'))) def ether_ntoa(ether): """Conversts an ethernet address in network byte order to the string representation.""" return ':'.join('%x' % x for x in struct.unpack('6B', ether)) attmap = common.Attributes(cn='cn', macAddress='macAddress') filter = '(objectClass=ieee802Device)' class Search(search.LDAPSearch): case_insensitive = ('cn', ) limit_attributes = ('cn', 'macAddress') required = ('cn', 'macAddress') def mk_filter(self): # we need a custom mk_filter because this is an | query if 'macAddress' in self.parameters: ether = self.parameters['macAddress'] alt_ether = ':'.join('%02x' % int(x, 16) for x in ether.split(':')) return '(&%s(|(%s=%s)(%s=%s)))' % (self.filter,