Changeset 988 for vendor/current/source4/scripting
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/source4/scripting
- Files:
-
- 15 added
- 3 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/scripting/bin/enablerecyclebin
r740 r988 3 3 # enabled the Recycle Bin optional feature 4 4 # 5 import base646 5 import optparse 7 import os8 6 import sys 9 7 … … 13 11 import samba 14 12 from samba import getopt as options, Ldb 15 from ldb import SCOPE_ SUBTREE, SCOPE_BASE, LdbError13 from ldb import SCOPE_BASE 16 14 import sys 17 15 import ldb … … 49 47 msg.dn = ldb.Dn(sam_ldb, "") 50 48 msg["enableOptionalFeature"] = ldb.MessageElement( 51 52 49 "CN=Partitions," + str(configbase) + ":766ddcd8-acd0-445e-f3b9-a7f9b6744f2a", 50 ldb.FLAG_MOD_ADD, "enableOptionalFeature") 53 51 res = sam_ldb.modify(msg) 54 52 -
vendor/current/source4/scripting/bin/minschema
r740 r988 6 6 import base64 7 7 import optparse 8 import os9 8 import sys 10 9 -
vendor/current/source4/scripting/bin/mymachinepw
r414 r988 43 43 secrets = ldb.Ldb(path) 44 44 45 search = "(&(objectclass=primaryDomain)(samaccountname=" + \46 netbios + "$))" 45 search = ("(&(objectclass=primaryDomain)(samaccountname=" + 46 netbios + "$))") 47 47 48 48 msg = secrets.search(expression=search, attrs=['secret']) -
vendor/current/source4/scripting/bin/rebuildextendeddn
r740 r988 9 9 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008 10 10 # 11 #12 11 # This program is free software; you can redistribute it and/or modify 13 12 # it under the terms of the GNU General Public License as published by 14 13 # the Free Software Foundation; either version 3 of the License, or 15 14 # (at your option) any later version. 16 # 15 # 17 16 # This program is distributed in the hope that it will be useful, 18 17 # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 19 # GNU General Public License for more details. 21 # 20 # 22 21 # You should have received a copy of the GNU General Public License 23 22 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 48 47 parser.add_option_group(credopts) 49 48 parser.add_option("--targetdir", type="string", metavar="DIR", 50 49 help="Set target directory") 51 50 52 51 opts = parser.parse_args()[0] 53 52 54 53 def message(text): 55 56 57 54 """print a message if quiet is not set.""" 55 if not opts.quiet: 56 print text 58 57 59 58 if len(sys.argv) == 1: 60 59 opts.interactive = True 61 60 62 61 lp = sambaopts.get_loadparm() … … 71 70 72 71 def get_paths(targetdir=None,smbconf=None): 73 74 75 76 77 78 72 if targetdir is not None: 73 if (not os.path.exists(os.path.join(targetdir, "etc"))): 74 os.makedirs(os.path.join(targetdir, "etc")) 75 smbconf = os.path.join(targetdir, "etc", "smb.conf") 76 if smbconf is None: 77 smbconf = param.default_path() 79 78 80 81 82 83 79 if not os.path.exists(smbconf): 80 print >>sys.stderr, "Unable to find smb.conf .. "+smbconf 81 parser.print_usage() 82 sys.exit(1) 84 83 85 86 87 88 84 lp = param.LoadParm() 85 lp.load(smbconf) 86 paths = provision_paths_from_lp(lp,"foo") 87 return paths 89 88 90 89 91 90 92 91 def rebuild_en_dn(credentials,session_info,paths): 93 lp = param.LoadParm() 94 lp.load(paths.smbconf) 95 names = ProvisionNames() 96 names.domain = lp.get("workgroup") 97 names.realm = lp.get("realm") 98 names.rootdn = "DC=" + names.realm.replace(".",",DC=") 99 100 attrs = ["dn" ] 101 dn = "" 102 sam_ldb = Ldb(paths.samdb, session_info=session_info, credentials=credentials,lp=lp) 103 attrs2 = ["schemaNamingContext"] 104 res2 = sam_ldb.search(expression="(objectClass=*)",base="", scope=SCOPE_BASE, attrs=attrs2) 105 attrs.extend(get_linked_attributes(ldb.Dn(sam_ldb,str(res2[0]["schemaNamingContext"])),sam_ldb).keys()) 106 attrs.extend(get_dnsyntax_attributes(ldb.Dn(sam_ldb,str(res2[0]["schemaNamingContext"])),sam_ldb)), 107 sam_ldb.transaction_start() 108 res = sam_ldb.search(expression="(cn=*)", scope=SCOPE_SUBTREE, attrs=attrs,controls=["search_options:1:2"] 109 ) 110 mod = "" 111 for i in range (0,len(res)): 112 #print >>sys.stderr,res[i].dn 113 dn = res[i].dn 114 for att in res[i]: 115 if ( (att != "dn" and att != "cn") and not (res[i][att] is None) ): 116 m = ldb.Message() 117 m.dn = ldb.Dn(sam_ldb, str(dn)) 118 saveatt = [] 119 for j in range (0,len( res[i][att])): 120 mod = mod +att +": "+str(res[i][att][j])+"\n" 121 saveatt.append(str(res[i][att][j])) 122 m[att] = ldb.MessageElement(saveatt, ldb.FLAG_MOD_REPLACE, att) 123 sam_ldb.modify(m) 124 res3 = sam_ldb.search(expression="(&(dn=%s)(%s=*))"%(dn,att),scope=SCOPE_SUBTREE, attrs=[att],controls=["search_options:1:2"]) 125 if( len(res3) == 0 or (len(res3[0][att])!= len(saveatt))): 126 print >>sys.stderr, str(dn) + " has no attr " +att+ " or a wrong value" 127 for satt in saveatt: 128 print >>sys.stderr,str(att)+" = "+satt 129 sam_ldb.transaction_cancel() 130 sam_ldb.transaction_commit() 92 lp = param.LoadParm() 93 lp.load(paths.smbconf) 94 names = ProvisionNames() 95 names.domain = lp.get("workgroup") 96 names.realm = lp.get("realm") 97 names.rootdn = "DC=" + names.realm.replace(".",",DC=") 98 99 attrs = ["dn" ] 100 dn = "" 101 sam_ldb = Ldb(paths.samdb, session_info=session_info, credentials=credentials,lp=lp) 102 attrs2 = ["schemaNamingContext"] 103 res2 = sam_ldb.search(expression="(objectClass=*)",base="", scope=SCOPE_BASE, attrs=attrs2) 104 attrs.extend(get_linked_attributes(ldb.Dn(sam_ldb,str(res2[0]["schemaNamingContext"])),sam_ldb).keys()) 105 attrs.extend(get_dnsyntax_attributes(ldb.Dn(sam_ldb,str(res2[0]["schemaNamingContext"])),sam_ldb)) 106 sam_ldb.transaction_start() 107 res = sam_ldb.search(expression="(cn=*)", scope=SCOPE_SUBTREE, attrs=attrs,controls=["search_options:1:2"]) 108 mod = "" 109 for i in range (0,len(res)): 110 #print >>sys.stderr,res[i].dn 111 dn = res[i].dn 112 for att in res[i]: 113 if ( (att != "dn" and att != "cn") and not (res[i][att] is None) ): 114 m = ldb.Message() 115 m.dn = ldb.Dn(sam_ldb, str(dn)) 116 saveatt = [] 117 for j in range (0,len( res[i][att])): 118 mod = mod +att +": "+str(res[i][att][j])+"\n" 119 saveatt.append(str(res[i][att][j])) 120 m[att] = ldb.MessageElement(saveatt, ldb.FLAG_MOD_REPLACE, att) 121 sam_ldb.modify(m) 122 res3 = sam_ldb.search(expression="(&(distinguishedName=%s)(%s=*))"%(dn,att),scope=SCOPE_SUBTREE, attrs=[att],controls=["search_options:1:2"]) 123 if( len(res3) == 0 or (len(res3[0][att])!= len(saveatt))): 124 print >>sys.stderr, str(dn) + " has no attr " +att+ " or a wrong value" 125 for satt in saveatt: 126 print >>sys.stderr,str(att)+" = "+satt 127 sam_ldb.transaction_cancel() 128 sam_ldb.transaction_commit() 131 129 132 130 133 134 135 paths = get_paths(targetdir=opts.targetdir,smbconf=smbconf) 136 131 paths = get_paths(targetdir=opts.targetdir, smbconf=smbconf) 137 132 138 133 rebuild_en_dn(creds,session,paths) -
vendor/current/source4/scripting/bin/rpcclient
r740 r988 24 24 if attr == 'this' or attr == 'thisown': 25 25 continue 26 26 27 27 result[attr] = getattr(obj, attr) 28 28 … … 52 52 except dcerpc.NTSTATUS, arg: 53 53 print 'The command returned an error: %s' % arg[1] 54 54 55 55 # Command handlers 56 56 … … 68 68 else: 69 69 print 'Command exited with signal %d' % os.WTERMSIG(status) 70 70 71 71 def do_EOF(self, line): 72 72 """Exits rpcclient.""" … … 78 78 def do_SamrEnumDomains(self, line): 79 79 """Enumerate domain names.""" 80 80 81 81 usage = 'usage: SamrEnumDomains' 82 82 … … 117 117 118 118 def do_SamrQueryDomInfo(self, line): 119 120 121 122 123 124 125 126 127 128 129 130 pipe = dcerpc.pipe_connect( 131 'ncacn_np:%s' % self.server, 132 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 133 self.cred) 134 135 connect_handle = samr.Connect(pipe) 136 137 138 139 140 141 119 """Return information about a domain designated by its SID.""" 120 121 usage = 'SamrQueryDomInfo DOMAIN_SID [info_level]' 122 123 parser = OptionParser(usage) 124 options, args = parser.parse_args(string.split(line)) 125 126 if (len(args) == 0) or (len(args) > 2): 127 print 'usage:', usage 128 return 129 130 pipe = dcerpc.pipe_connect( 131 'ncacn_np:%s' % self.server, 132 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 133 self.cred) 134 135 connect_handle = samr.Connect(pipe) 136 domain_handle = connect_handle.OpenDomain(args[0]) 137 138 if (len(args) == 2): 139 result = domain_handle.QueryDomainInfo(int(args[1])) 140 else: 141 result = domain_handle.QueryDomainInfo() 142 142 143 143 pprint(swig2dict(result)) 144 144 145 145 def do_SamrQueryDomInfo2(self, line): 146 146 """Return information about a domain designated by its SID. 147 147 (Windows 2000 and >)""" 148 148 149 150 151 152 153 154 155 156 157 pipe = dcerpc.pipe_connect( 158 'ncacn_np:%s' % self.server, 159 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 160 self.cred) 161 162 connect_handle = samr.Connect(pipe) 163 164 165 166 167 168 149 usage = 'SamrQueryDomInfo2 DOMAIN_SID [info_level] (Windows 2000 and >)' 150 parser = OptionParser(usage) 151 options, args = parser.parse_args(string.split(line)) 152 153 if len(args) == 0 or len(args) > 2: 154 print 'usage:', usage 155 return 156 157 pipe = dcerpc.pipe_connect( 158 'ncacn_np:%s' % self.server, 159 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 160 self.cred) 161 162 connect_handle = samr.Connect(pipe) 163 domain_handle = connect_handle.OpenDomain(args[0]) 164 165 if (len(args) == 2): 166 result = domain_handle.QueryDomainInfo2(int(args[1])) 167 else: 168 result = domain_handle.QueryDomainInfo2() 169 169 170 170 pprint(swig2dict(result)) 171 171 172 172 def do_SamrEnumDomainGroups(self, line): 173 174 175 173 """Return the list of groups of a domain designated by its SID.""" 174 175 usage = 'SamrEnumDomainGroups DOMAIN_SID' 176 176 177 177 parser = OptionParser(usage) … … 187 187 self.cred) 188 188 189 connect_handle = samr.Connect(pipe) 190 191 192 189 connect_handle = samr.Connect(pipe) 190 domain_handle = connect_handle.OpenDomain(args[0]) 191 192 result = domain_handle.EnumDomainGroups() 193 193 194 194 pprint(result) … … 198 198 by its SID.""" 199 199 200 200 usage = 'SamrEnumDomainAliases DOMAIN_SID' 201 201 202 202 parser = OptionParser(usage) … … 215 215 domain_handle = connect_handle.OpenDomain(args[0]) 216 216 217 217 result = domain_handle.EnumDomainAliases() 218 218 219 219 pprint(result) 220 220 221 221 def do_SamrEnumDomainUsers(self, line): 222 223 224 225 226 parser = OptionParser(usage) 227 options, args = parser.parse_args(string.split(line)) 228 229 230 231 232 233 pipe = dcerpc.pipe_connect( 234 'ncacn_np:%s' % self.server, 235 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 236 self.cred) 237 238 connect_handle = samr.Connect(pipe) 239 domain_handle = connect_handle.OpenDomain(args[0]) 240 241 242 243 244 222 """Return the list of users of a domain designated by its SID.""" 223 224 usage = 'SamrEnumDomainUsers DOMAIN_SID [user_account_flags]' 225 226 parser = OptionParser(usage) 227 options, args = parser.parse_args(string.split(line)) 228 229 if (len(args) == 0) or (len(args) > 2): 230 print 'usage:', usage 231 return 232 233 pipe = dcerpc.pipe_connect( 234 'ncacn_np:%s' % self.server, 235 dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION), 236 self.cred) 237 238 connect_handle = samr.Connect(pipe) 239 domain_handle = connect_handle.OpenDomain(args[0]) 240 241 if (len(args) == 2): 242 result = domain_handle.EnumDomainUsers(int(args[1])) 243 else: 244 result = domain_handle.EnumDomainUsers() 245 245 246 246 pprint(result) … … 289 289 290 290 if username != '': 291 291 cred = (domain, username, password) 292 292 293 293 # Run command loop -
vendor/current/source4/scripting/bin/samba3dump
r740 r988 14 14 import samba 15 15 import samba.samba3 16 from samba.samba3 import param as s3param 17 from samba.dcerpc import lsa 16 18 17 19 parser = optparse.OptionParser("samba3dump <libdir> [<smb.conf>]") … … 30 32 def print_samba3_policy(pol): 31 33 print_header("Account Policies") 32 print "Min password length: %d" % pol .min_password_length33 print "Password history length: %d" % pol .password_history34 if pol .user_must_logon_to_change_password:35 print "User must logon to change password: %d" % pol .user_must_logon_to_change_password36 if pol .maximum_password_age:37 print "Maximum password age: %d" % pol .maximum_password_age38 if pol .minimum_password_age:39 print "Minimum password age: %d" % pol .minimum_password_age40 if pol .lockout_duration:41 print "Lockout duration: %d" % pol .lockout_duration42 if pol .reset_count_minutes:43 print "Reset Count Minutes: %d" % pol .reset_count_minutes44 if pol .bad_lockout_minutes:45 print "Bad Lockout Minutes: %d" % pol .bad_lockout_minutes46 if pol .disconnect_time:47 print "Disconnect Time: %d" % pol .disconnect_time48 if pol .refuse_machine_password_change:49 print "Refuse Machine Password Change: %d" % pol .refuse_machine_password_change34 print "Min password length: %d" % pol['min password length'] 35 print "Password history length: %d" % pol['password history'] 36 if pol['user must logon to change password']: 37 print "User must logon to change password: %d" % pol['user must logon to change password'] 38 if pol['maximum password age']: 39 print "Maximum password age: %d" % pol['maximum password age'] 40 if pol['minimum password age']: 41 print "Minimum password age: %d" % pol['minimum password age'] 42 if pol['lockout duration']: 43 print "Lockout duration: %d" % pol['lockout duration'] 44 if pol['reset count minutes']: 45 print "Reset Count Minutes: %d" % pol['reset count minutes'] 46 if pol['bad lockout attempt']: 47 print "Bad Lockout Minutes: %d" % pol['bad lockout attempt'] 48 if pol['disconnect time']: 49 print "Disconnect Time: %d" % pol['disconnect time'] 50 if pol['refuse machine password change']: 51 print "Refuse Machine Password Change: %d" % pol['refuse machine password change'] 50 52 51 53 def print_samba3_sam(samdb): 52 54 print_header("SAM Database") 53 for user in samdb :54 print "%s " % user55 for user in samdb.search_users(0): 56 print "%s (%d): %s" % (user['account_name'], user['rid'], user['fullname']) 55 57 56 def print_samba3_shares( shares):58 def print_samba3_shares(lp): 57 59 print_header("Configured shares") 58 for s in shares:59 print "--- %s ---" % s .name60 for p in s:61 print "\t%s = %s" % (p .key, p.value)60 for s in lp.services(): 61 print "--- %s ---" % s 62 for p in ['path']: 63 print "\t%s = %s" % (p, lp.get(p, s)) 62 64 print "" 63 65 … … 114 116 print_header("Group Mappings") 115 117 116 for sid in groupdb.groupsids(): 117 print "\t--- Group: %s ---" % sid 118 for g in groupdb.enum_group_mapping(samba.samba3.passdb.get_global_sam_sid(), 119 lsa.SID_NAME_DOM_GRP): 120 print "\t--- Group: %s ---" % g.sid 118 121 119 122 def print_samba3_aliases(groupdb): 120 for sid in groupdb.aliases(): 121 print "\t--- Alias: %s ---" % sid 123 for g in groupdb.enum_group_mapping(samba.samba3.passdb.get_global_sam_sid(), 124 lsa.SID_NAME_ALIAS): 125 print "\t--- Alias: %s ---" % g.sid 122 126 123 127 def print_samba3_idmapdb(idmapdb): … … 134 138 135 139 def print_samba3(samba3): 136 print_samba3_policy(samba3.get_policy_db()) 140 passdb = samba3.get_sam_db() 141 print_samba3_policy(passdb.get_account_policy()) 137 142 print_samba3_winsdb(samba3.get_wins_db()) 138 143 print_samba3_regdb(samba3.get_registry()) 139 144 print_samba3_secrets(samba3.get_secrets_db()) 140 145 print_samba3_idmapdb(samba3.get_idmap_db()) 141 print_samba3_sam(samba3.get_sam_db()) 142 groupdb = samba3.get_groupmapping_db() 143 print_samba3_groupmappings(groupdb) 144 print_samba3_aliases(groupdb) 145 print_samba3_shares(samba3.get_shares()) 146 print_samba3_sam(passdb) 147 print_samba3_groupmappings(passdb) 148 print_samba3_aliases(passdb) 149 print_samba3_shares(samba3.lp) 146 150 147 151 def print_samba3_summary(samba3): 148 152 print "WINS db entries: %d" % len(samba3.get_wins_db()) 149 153 print "Registry key count: %d" % len(samba3.get_registry()) 150 groupdb = samba3.get_groupmapping_db()151 print "Groupmap count: %d" % len( list(groupdb.groupsids()))152 print "Alias count: %d" % len( list(groupdb.aliases()))154 passdb = samba3.get_sam_db() 155 print "Groupmap count: %d" % len(passdb.enum_group_mapping()) 156 print "Alias count: %d" % len(passdb.search_aliases()) 153 157 idmapdb = samba3.get_idmap_db() 154 158 print "Idmap count: %d" % (len(list(idmapdb.uids())) + len(list(idmapdb.gids()))) 155 159 160 if len(args) < 1: 161 parser.print_help() 162 sys.exit(1) 163 156 164 libdir = args[0] 157 if len(args) >1:165 if len(args) < 1: 158 166 smbconf = args[1] 159 167 else: 160 168 smbconf = os.path.join(libdir, "smb.conf") 161 169 162 samba3 = samba.samba3.Samba3(libdir, smbconf) 170 s3_lp = s3param.get_context() 171 s3_lp.set("private dir", libdir) 172 s3_lp.set("state directory", libdir) 173 s3_lp.set("lock directory", libdir) 174 s3_lp.load(smbconf) 175 samba3 = samba.samba3.Samba3(smbconf, s3_lp) 163 176 164 177 if opts.format == "summary": -
vendor/current/source4/scripting/bin/samba_backup
r740 r988 1 1 #!/bin/sh 2 2 # 3 # Copyright (C) Matthieu Patou <mat@matws.net> 2010 3 # Copyright (C) Matthieu Patou <mat@matws.net> 2010-2011 4 4 # 5 5 # This program is free software; you can redistribute it and/or modify … … 16 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 # 18 # Revised 2013-09-25, Brian Martin, as follows: 19 # - Allow retention period ("DAYS") to be specified as a parameter. 20 # - Allow individual positional parameters to be left at the default 21 # by specifying "-" 22 # - Use IS0 8601 standard dates (yyyy-mm-dd instead of mmddyyyy). 23 # - Display tar exit codes when reporting errors. 24 # - Don't send error messages to /dev/null, so we know what failed. 25 # - Suppress useless tar "socket ignored" message. 26 # - Fix retention period bug when deleting old backups ($DAYS variable 27 # could be set, but was ignored). 28 29 18 30 19 31 FROMWHERE=/usr/local/samba 20 32 WHERE=/usr/local/backups 33 DAYS=90 # Set default retention period. 21 34 if [ -n "$1" ] && [ "$1" = "-h" -o "$1" = "--usage" ]; then 22 echo "samba_backup [provisiondir] [destinationdir]" 23 echo "Will backup your provision located in provisiondir to archive stored in destinationdir" 35 echo "samba_backup [provisiondir] [destinationdir] [retpd]" 36 echo "Will backup your provision located in provisiondir to archive stored" 37 echo "in destinationdir for retpd days. Use - to leave an option unchanged." 24 38 echo "Default provisiondir: $FROMWHERE" 25 39 echo "Default destinationdir: $WHERE" 40 echo "Default destinationdir: $DAYS" 26 41 exit 0 27 42 fi 28 43 29 [ -n "$1" -a -d "$1" ]&&FROMWHERE=$1 30 [ -n "$2" -a -d "$2" ]&&WHERE=$2 44 [ -n "$1" -a "$1" != "-" ]&&FROMWHERE=$1 # Use parm or default if "-". Validate later. 45 [ -n "$2" -a "$2" != "-" ]&&WHERE=$2 # Use parm or default if "-". Validate later. 46 [ -n "$3" -a "$3" -eq "$3" 2> /dev/null ]&&DAYS=$3 # Use parm or default if non-numeric (incl "-"). 31 47 32 48 DIRS="private etc sysvol" 33 49 #Number of days to keep the backup 34 DAYS=90 35 WHEN=`date +%d%m%y` 50 WHEN=`date +%Y-%m-%d` # ISO 8601 standard date. 51 52 if [ ! -d $WHERE ]; then 53 echo "Missing backup directory $WHERE" 54 exit 1 55 fi 56 57 if [ ! -d $FROMWHERE ]; then 58 echo "Missing or wrong provision directory $FROMWHERE" 59 exit 1 60 fi 36 61 37 62 cd $FROMWHERE … … 43 68 for ldb in `find $relativedirname -name "*.ldb"`; do 44 69 tdbbackup $ldb 45 if [ $? -ne 0 ]; then 46 echo "Error while backuping $ldb" 70 Status=$? # Preserve $? for message, since [ alters it. 71 if [ $Status -ne 0 ]; then 72 echo "Error while backing up $ldb - status $Status" 47 73 exit 1 48 74 fi 49 75 done 50 tar cjf ${WHERE}/samba4_${n}.${WHEN}.tar.bz2 $relativedirname --exclude=*.ldb >/dev/null 2>&1 51 if [ $? -ne 0 ]; then 52 echo "Error while archiving ${WHERE}/samba4_${n}.${WHEN}.tar.bz2" 76 # Run the backup. 77 # --warning=no-file-ignored set to suppress "socket ignored" messages. 78 tar cjf ${WHERE}/samba4_${n}.${WHEN}.tar.bz2 $relativedirname --exclude=\*.ldb --warning=no-file-ignored --transform 's/.ldb.bak$/.ldb/' 79 Status=$? # Preserve $? for message, since [ alters it. 80 if [ $Status -ne 0 -a $Status -ne 1 ]; then # Ignore 1 - private dir is always changing. 81 echo "Error while archiving ${WHERE}/samba4_${n}.${WHEN}.tar.bz2 - status = $Status" 53 82 exit 1 54 83 fi 55 84 find $relativedirname -name "*.ldb.bak" -exec rm {} \; 56 85 else 57 tar cjf ${WHERE}/${n}.${WHEN}.tar.bz2 $relativedirname >/dev/null 2>&1 58 if [ $? -ne 0 ]; then 59 echo "Error while archiving ${WHERE}/${n}.${WHEN}.tar.bz2" 86 # Run the backup. 87 # --warning=no-file-ignored set to suppress "socket ignored" messages. 88 tar cjf ${WHERE}/${n}.${WHEN}.tar.bz2 $relativedirname --warning=no-file-ignored 89 Status=$? # Preserve $? for message, since [ alters it. 90 if [ $Status -ne 0 ]; then 91 echo "Error while archiving ${WHERE}/${n}.${WHEN}.tar.bz2 - status = $Status" 60 92 exit 1 61 93 fi … … 63 95 done 64 96 65 find $WHERE -name "samba4_*bz2" -mtime + 90 -exec rm {} \; >/dev/null 2>&197 find $WHERE -name "samba4_*bz2" -mtime +$DAYS -exec rm {} \; -
vendor/current/source4/scripting/bin/samba_dnsupdate
r740 r988 1 1 #!/usr/bin/env python 2 # vim: expandtab 2 3 # 3 4 # update our DNS names using TSIG-GSS … … 42 43 from samba import getopt as options 43 44 from ldb import SCOPE_BASE 45 from samba import dsdb 44 46 from samba.auth import system_session 45 47 from samba.samdb import SamDB 46 48 from samba.dcerpc import netlogon, winbind 47 49 48 samba.ensure_ external_module("dns", "dnspython")50 samba.ensure_third_party_module("dns", "dnspython") 49 51 import dns.resolver 50 52 import dns.exception … … 63 65 parser.add_option("--use-file", type="string", help="Use a file, rather than real DNS calls") 64 66 parser.add_option("--update-list", type="string", help="Add DNS names from the given file") 67 parser.add_option("--update-cache", type="string", help="Cache database of already registered records") 65 68 parser.add_option("--fail-immediately", action='store_true', help="Exit on first failure") 69 parser.add_option("--no-credentials", dest='nocreds', action='store_true', help="don't try and get credentials") 70 parser.add_option("--no-substiutions", dest='nosubs', action='store_true', help="don't try and expands variables in file specified by --update-list") 66 71 67 72 creds = None … … 90 95 sys.exit(0) 91 96 97 IP6s = [] 98 IP4s = [] 99 for i in IPs: 100 if i.find(':') != -1: 101 IP6s.append(i) 102 else: 103 IP4s.append(i) 104 105 92 106 if opts.verbose: 93 107 print "IPs: %s" % IPs 94 108 95 ######################################################## 96 # get credentials if we haven't got them already 109 97 110 def get_credentials(lp): 111 """# get credentials if we haven't got them already.""" 98 112 from samba import credentials 99 global ccachename, creds 100 if creds is not None: 101 return 113 global ccachename 102 114 creds = credentials.Credentials() 103 115 creds.guess(lp) … … 105 117 creds.set_krb_forwardable(credentials.NO_KRB_FORWARDABLE) 106 118 (tmp_fd, ccachename) = tempfile.mkstemp() 107 creds.get_named_ccache(lp, ccachename) 108 109 110 ############################################# 111 # an object to hold a parsed DNS line 119 try: 120 creds.get_named_ccache(lp, ccachename) 121 except RuntimeError as e: 122 os.unlink(ccachename) 123 raise e 124 125 112 126 class dnsobj(object): 127 """an object to hold a parsed DNS line""" 128 113 129 def __init__(self, string_form): 114 130 list = string_form.split() 131 if len(list) < 3: 132 raise Exception("Invalid DNS entry %r" % string_form) 115 133 self.dest = None 116 134 self.port = None … … 119 137 self.existing_weight = None 120 138 self.type = list[0] 121 self.name = list[1].lower() 139 self.name = list[1] 140 self.nameservers = [] 122 141 if self.type == 'SRV': 123 self.dest = list[2].lower() 142 if len(list) < 4: 143 raise Exception("Invalid DNS entry %r" % string_form) 144 self.dest = list[2] 124 145 self.port = list[3] 125 elif self.type == 'A':146 elif self.type in ['A', 'AAAA']: 126 147 self.ip = list[2] # usually $IP, which gets replaced 127 148 elif self.type == 'CNAME': 128 self.dest = list[2].lower() 149 self.dest = list[2] 150 elif self.type == 'NS': 151 self.dest = list[2] 129 152 else: 130 print "Received unexpected DNS reply of type %s" % self.type 131 raise 153 raise Exception("Received unexpected DNS reply of type %s: %s" % (self.type, string_form)) 132 154 133 155 def __str__(self): 134 if d.type == "A": return "%s %s %s" % (self.type, self.name, self.ip) 135 if d.type == "SRV": return "%s %s %s %s" % (self.type, self.name, self.dest, self.port) 136 if d.type == "CNAME": return "%s %s %s" % (self.type, self.name, self.dest) 137 138 139 ################################################ 140 # parse a DNS line from 156 if self.type == "A": 157 return "%s %s %s" % (self.type, self.name, self.ip) 158 if self.type == "AAAA": 159 return "%s %s %s" % (self.type, self.name, self.ip) 160 if self.type == "SRV": 161 return "%s %s %s %s" % (self.type, self.name, self.dest, self.port) 162 if self.type == "CNAME": 163 return "%s %s %s" % (self.type, self.name, self.dest) 164 if self.type == "NS": 165 return "%s %s %s" % (self.type, self.name, self.dest) 166 167 141 168 def parse_dns_line(line, sub_vars): 169 """parse a DNS line from.""" 170 if line.startswith("SRV _ldap._tcp.pdc._msdcs.") and not samdb.am_pdc(): 171 # We keep this as compat to the dns_update_list of 4.0/4.1 172 if opts.verbose: 173 print "Skipping PDC entry (%s) as we are not a PDC" % line 174 return None 142 175 subline = samba.substitute_var(line, sub_vars) 143 d = dnsobj(subline)144 return d145 146 ############################################ 147 # see if two hostnames match 176 if subline == '' or subline[0] == "#": 177 return None 178 return dnsobj(subline) 179 180 148 181 def hostname_match(h1, h2): 182 """see if two hostnames match.""" 149 183 h1 = str(h1) 150 184 h2 = str(h2) … … 152 186 153 187 154 ############################################155 # check that a DNS entry exists156 188 def check_dns_name(d): 189 """check that a DNS entry exists.""" 157 190 normalised_name = d.name.rstrip('.') + '.' 158 191 if opts.verbose: 159 192 print "Looking for DNS entry %s as %s" % (d, normalised_name) 160 193 161 194 if opts.use_file is not None: 162 195 try: … … 164 197 except IOError: 165 198 return False 166 199 167 200 for line in dns_file: 168 201 line = line.strip() … … 173 206 return False 174 207 208 resolv_conf = os.getenv('RESOLV_WRAPPER_CONF') 209 if not resolv_conf: 210 resolv_conf = '/etc/resolv.conf' 211 resolver = dns.resolver.Resolver(filename=resolv_conf, configure=True) 212 213 if d.nameservers != []: 214 resolver.nameservers = d.nameservers 215 else: 216 d.nameservers = resolver.nameservers 217 175 218 try: 176 ans = dns.resolver.query(normalised_name, d.type)219 ans = resolver.query(normalised_name, d.type) 177 220 except dns.exception.DNSException: 178 221 if opts.verbose: 179 222 print "Failed to find DNS entry %s" % d 180 223 return False 181 if d.type == 'A':224 if d.type in ['A', 'AAAA']: 182 225 # we need to be sure that our IP is there 183 226 for rdata in ans: 184 227 if str(rdata) == str(d.ip): 185 228 return True 186 if d.type == 'CNAME':229 elif d.type == 'CNAME': 187 230 for i in range(len(ans)): 188 231 if hostname_match(ans[i].target, d.dest): 189 232 return True 190 if d.type == 'SRV': 233 elif d.type == 'NS': 234 for i in range(len(ans)): 235 if hostname_match(ans[i].target, d.dest): 236 return True 237 elif d.type == 'SRV': 191 238 for rdata in ans: 192 239 if opts.verbose: … … 205 252 206 253 207 ########################################### 208 # get the list of substitution vars 209 def get_subst_vars(): 254 def get_subst_vars(samdb): 255 """get the list of substitution vars.""" 210 256 global lp, am_rodc 211 257 vars = {} 212 258 213 samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), 214 lp=lp) 215 216 vars['DNSDOMAIN'] = lp.get('realm').lower() 217 vars['DNSFOREST'] = lp.get('realm').lower() 218 vars['HOSTNAME'] = lp.get('netbios name').lower() + "." + vars['DNSDOMAIN'] 259 vars['DNSDOMAIN'] = samdb.domain_dns_name() 260 vars['DNSFOREST'] = samdb.forest_dns_name() 261 vars['HOSTNAME'] = samdb.host_dns_name() 219 262 vars['NTDSGUID'] = samdb.get_ntds_GUID() 220 263 vars['SITE'] = samdb.server_site_name() 221 res = samdb.search(base= None, scope=SCOPE_BASE, attrs=["objectGUID"])264 res = samdb.search(base=samdb.get_default_basedn(), scope=SCOPE_BASE, attrs=["objectGUID"]) 222 265 guid = samdb.schema_format_value("objectGUID", res[0]['objectGUID'][0]) 223 266 vars['DOMAINGUID'] = guid 267 268 vars['IF_DC'] = "" 269 vars['IF_RWDC'] = "# " 270 vars['IF_RODC'] = "# " 271 vars['IF_PDC'] = "# " 272 vars['IF_GC'] = "# " 273 vars['IF_RWGC'] = "# " 274 vars['IF_ROGC'] = "# " 275 vars['IF_DNS_DOMAIN'] = "# " 276 vars['IF_RWDNS_DOMAIN'] = "# " 277 vars['IF_RODNS_DOMAIN'] = "# " 278 vars['IF_DNS_FOREST'] = "# " 279 vars['IF_RWDNS_FOREST'] = "# " 280 vars['IF_R0DNS_FOREST'] = "# " 281 224 282 am_rodc = samdb.am_rodc() 283 if am_rodc: 284 vars['IF_RODC'] = "" 285 else: 286 vars['IF_RWDC'] = "" 287 288 if samdb.am_pdc(): 289 vars['IF_PDC'] = "" 290 291 # check if we "are DNS server" 292 res = samdb.search(base=samdb.get_config_basedn(), 293 expression='(objectguid=%s)' % vars['NTDSGUID'], 294 attrs=["options", "msDS-hasMasterNCs"]) 295 296 if len(res) == 1: 297 if "options" in res[0]: 298 options = int(res[0]["options"][0]) 299 if (options & dsdb.DS_NTDSDSA_OPT_IS_GC) != 0: 300 vars['IF_GC'] = "" 301 if am_rodc: 302 vars['IF_ROGC'] = "" 303 else: 304 vars['IF_RWGC'] = "" 305 306 basedn = str(samdb.get_default_basedn()) 307 forestdn = str(samdb.get_root_basedn()) 308 309 if "msDS-hasMasterNCs" in res[0]: 310 for e in res[0]["msDS-hasMasterNCs"]: 311 if str(e) == "DC=DomainDnsZones,%s" % basedn: 312 vars['IF_DNS_DOMAIN'] = "" 313 if am_rodc: 314 vars['IF_RODNS_DOMAIN'] = "" 315 else: 316 vars['IF_RWDNS_DOMAIN'] = "" 317 if str(e) == "DC=ForestDnsZones,%s" % forestdn: 318 vars['IF_DNS_FOREST'] = "" 319 if am_rodc: 320 vars['IF_RODNS_FOREST'] = "" 321 else: 322 vars['IF_RWDNS_FOREST'] = "" 225 323 226 324 return vars 227 325 228 326 229 ############################################ 230 # call nsupdate for an entry 231 def call_nsupdate(d): 232 global ccachename, nsupdate_cmd 233 234 if opts.verbose: 235 print "Calling nsupdate for %s" % d 327 def call_nsupdate(d, op="add"): 328 """call nsupdate for an entry.""" 329 global ccachename, nsupdate_cmd, krb5conf 330 331 assert(op in ["add", "delete"]) 332 333 if opts.verbose: 334 print "Calling nsupdate for %s (%s)" % (d, op) 236 335 237 336 if opts.use_file is not None: 238 wfile = open(opts.use_file, 'a') 239 fcntl.lockf(wfile, fcntl.LOCK_EX) 240 wfile.write(str(d)+"\n") 241 fcntl.lockf(wfile, fcntl.LOCK_UN) 337 try: 338 rfile = open(opts.use_file, 'r+') 339 except IOError: 340 # Perhaps create it 341 rfile = open(opts.use_file, 'w+') 342 # Open it for reading again, in case someone else got to it first 343 rfile = open(opts.use_file, 'r+') 344 fcntl.lockf(rfile, fcntl.LOCK_EX) 345 (file_dir, file_name) = os.path.split(opts.use_file) 346 (tmp_fd, tmpfile) = tempfile.mkstemp(dir=file_dir, prefix=file_name, suffix="XXXXXX") 347 wfile = os.fdopen(tmp_fd, 'a') 348 rfile.seek(0) 349 for line in rfile: 350 if op == "delete": 351 l = parse_dns_line(line, {}) 352 if str(l).lower() == str(d).lower(): 353 continue 354 wfile.write(line) 355 if op == "add": 356 wfile.write(str(d)+"\n") 357 os.rename(tmpfile, opts.use_file) 358 fcntl.lockf(rfile, fcntl.LOCK_UN) 242 359 return 243 360 … … 246 363 (tmp_fd, tmpfile) = tempfile.mkstemp() 247 364 f = os.fdopen(tmp_fd, 'w') 365 if d.nameservers != []: 366 f.write('server %s\n' % d.nameservers[0]) 248 367 if d.type == "A": 249 f.write("update add %s %u A %s\n" % (normalised_name, default_ttl, d.ip)) 368 f.write("update %s %s %u A %s\n" % (op, normalised_name, default_ttl, d.ip)) 369 if d.type == "AAAA": 370 f.write("update %s %s %u AAAA %s\n" % (op, normalised_name, default_ttl, d.ip)) 250 371 if d.type == "SRV": 251 if d.existing_port is not None:372 if op == "add" and d.existing_port is not None: 252 373 f.write("update delete %s SRV 0 %s %s %s\n" % (normalised_name, d.existing_weight, 253 374 d.existing_port, d.dest)) 254 f.write("update add %s %u SRV 0 100 %s %s\n" % (normalised_name, default_ttl, d.port, d.dest))375 f.write("update %s %s %u SRV 0 100 %s %s\n" % (op, normalised_name, default_ttl, d.port, d.dest)) 255 376 if d.type == "CNAME": 256 f.write("update add %s %u CNAME %s\n" % (normalised_name, default_ttl, d.dest)) 377 f.write("update %s %s %u CNAME %s\n" % (op, normalised_name, default_ttl, d.dest)) 378 if d.type == "NS": 379 f.write("update %s %s %u NS %s\n" % (op, normalised_name, default_ttl, d.dest)) 257 380 if opts.verbose: 258 381 f.write("show\n") … … 260 383 f.close() 261 384 262 os.environ["KRB5CCNAME"] = ccachename 385 global error_count 386 if ccachename: 387 os.environ["KRB5CCNAME"] = ccachename 263 388 try: 264 389 cmd = nsupdate_cmd[:] 265 390 cmd.append(tmpfile) 266 subprocess.check_call(cmd, shell=False) 391 env = os.environ 392 if krb5conf: 393 env["KRB5_CONFIG"] = krb5conf 394 if ccachename: 395 env["KRB5CCNAME"] = ccachename 396 ret = subprocess.call(cmd, shell=False, env=env) 397 if ret != 0: 398 if opts.fail_immediately: 399 if opts.verbose: 400 print("Failed update with %s" % tmpfile) 401 sys.exit(1) 402 error_count = error_count + 1 403 if opts.verbose: 404 print("Failed nsupdate: %d" % ret) 267 405 except Exception, estr: 268 global error_count269 406 if opts.fail_immediately: 270 407 sys.exit(1) … … 276 413 277 414 278 def rodc_dns_update(d, t ):415 def rodc_dns_update(d, t, op): 279 416 '''a single DNS update via the RODC netlogon call''' 280 417 global sub_vars 418 419 assert(op in ["add", "delete"]) 281 420 282 421 if opts.verbose: … … 303 442 if d.port is not None: 304 443 name.port = int(d.port) 305 name.dns_register = True 444 if op == "add": 445 name.dns_register = True 446 else: 447 name.dns_register = False 306 448 dns_names.names = [ name ] 307 449 site_name = sub_vars['SITE'].decode('utf-8') … … 322 464 323 465 324 def call_rodc_update(d ):466 def call_rodc_update(d, op="add"): 325 467 '''RODCs need to use the netlogon API for nsupdate''' 326 468 global lp, sub_vars 469 470 assert(op in ["add", "delete"]) 327 471 328 472 # we expect failure for 3268 if we aren't a GC … … 345 489 if subname.lower() == d.name.lower(): 346 490 # found a match - do the update 347 rodc_dns_update(d, t )491 rodc_dns_update(d, t, op) 348 492 return 349 493 if opts.verbose: … … 357 501 dns_update_list = lp.private_path('dns_update_list') 358 502 503 if opts.update_cache: 504 dns_update_cache = opts.update_cache 505 else: 506 dns_update_cache = lp.private_path('dns_update_cache') 507 359 508 # use our private krb5.conf to avoid problems with the wrong domain 360 509 # bind9 nsupdate wants the default domain set … … 364 513 file = open(dns_update_list, "r") 365 514 366 # get the substitution dictionary 367 sub_vars = get_subst_vars() 515 if opts.nosubs: 516 sub_vars = {} 517 else: 518 samdb = SamDB(url=lp.samdb_url(), session_info=system_session(), lp=lp) 519 520 # get the substitution dictionary 521 sub_vars = get_subst_vars(samdb) 368 522 369 523 # build up a list of update commands to pass to nsupdate 370 524 update_list = [] 371 525 dns_list = [] 526 cache_list = [] 527 delete_list = [] 528 529 dup_set = set() 530 cache_set = set() 531 532 rebuild_cache = False 533 try: 534 cfile = open(dns_update_cache, 'r+') 535 except IOError: 536 # Perhaps create it 537 cfile = open(dns_update_cache, 'w+') 538 # Open it for reading again, in case someone else got to it first 539 cfile = open(dns_update_cache, 'r+') 540 fcntl.lockf(cfile, fcntl.LOCK_EX) 541 for line in cfile: 542 line = line.strip() 543 if line == '' or line[0] == "#": 544 continue 545 c = parse_dns_line(line, {}) 546 if c is None: 547 continue 548 if str(c) not in cache_set: 549 cache_list.append(c) 550 cache_set.add(str(c)) 372 551 373 552 # read each line, and check that the DNS name exists … … 377 556 continue 378 557 d = parse_dns_line(line, sub_vars) 379 dns_list.append(d) 558 if d is None: 559 continue 560 if d.type == 'A' and len(IP4s) == 0: 561 continue 562 if d.type == 'AAAA' and len(IP6s) == 0: 563 continue 564 if str(d) not in dup_set: 565 dns_list.append(d) 566 dup_set.add(str(d)) 380 567 381 568 # now expand the entries, if any are A record with ip set to $IP 382 569 # then replace with multiple entries, one for each interface IP 383 570 for d in dns_list: 384 if d.type == 'A' and d.ip == "$IP": 385 d.ip = IPs[0] 386 for i in range(len(IPs)-1): 571 if d.ip != "$IP": 572 continue 573 if d.type == 'A': 574 d.ip = IP4s[0] 575 for i in range(len(IP4s)-1): 387 576 d2 = dnsobj(str(d)) 388 d2.ip = IPs[i+1] 577 d2.ip = IP4s[i+1] 578 dns_list.append(d2) 579 if d.type == 'AAAA': 580 d.ip = IP6s[0] 581 for i in range(len(IP6s)-1): 582 d2 = dnsobj(str(d)) 583 d2.ip = IP6s[i+1] 389 584 dns_list.append(d2) 390 585 391 586 # now check if the entries already exist on the DNS server 392 587 for d in dns_list: 393 if opts.all_names or not check_dns_name(d): 588 found = False 589 for c in cache_list: 590 if str(c).lower() == str(d).lower(): 591 found = True 592 break 593 if not found: 594 rebuild_cache = True 595 if opts.all_names: 394 596 update_list.append(d) 395 396 if len(update_list) == 0: 597 if opts.verbose: 598 print "force update: %s" % d 599 elif not check_dns_name(d): 600 update_list.append(d) 601 if opts.verbose: 602 print "need update: %s" % d 603 604 605 for c in cache_list: 606 found = False 607 for d in dns_list: 608 if str(c).lower() == str(d).lower(): 609 found = True 610 break 611 if found: 612 continue 613 rebuild_cache = True 614 if not opts.all_names and not check_dns_name(c): 615 continue 616 delete_list.append(c) 617 if opts.verbose: 618 print "need delete: %s" % c 619 620 if len(delete_list) == 0 and len(update_list) == 0 and not rebuild_cache: 397 621 if opts.verbose: 398 622 print "No DNS updates needed" 399 623 sys.exit(0) 624 else: 625 if opts.verbose: 626 print "%d DNS updates and %d DNS deletes needed" % (len(update_list), len(delete_list)) 400 627 401 628 # get our krb5 creds 402 get_credentials(lp) 629 if len(delete_list) != 0 or len(update_list) != 0: 630 if not opts.nocreds: 631 get_credentials(lp) 632 633 # ask nsupdate to delete entries as needed 634 for d in delete_list: 635 if am_rodc: 636 if d.name.lower() == domain.lower(): 637 if opts.verbose: 638 print "skip delete (rodc): %s" % d 639 continue 640 if not d.type in [ 'A', 'AAAA' ]: 641 if opts.verbose: 642 print "delete (rodc): %s" % d 643 call_rodc_update(d, op="delete") 644 else: 645 if opts.verbose: 646 print "delete (nsupdate): %s" % d 647 call_nsupdate(d, op="delete") 648 else: 649 if opts.verbose: 650 print "delete (nsupdate): %s" % d 651 call_nsupdate(d, op="delete") 403 652 404 653 # ask nsupdate to add entries as needed … … 406 655 if am_rodc: 407 656 if d.name.lower() == domain.lower(): 657 if opts.verbose: 658 print "skip (rodc): %s" % d 408 659 continue 409 if d.type != 'A': 660 if not d.type in [ 'A', 'AAAA' ]: 661 if opts.verbose: 662 print "update (rodc): %s" % d 410 663 call_rodc_update(d) 411 664 else: 665 if opts.verbose: 666 print "update (nsupdate): %s" % d 412 667 call_nsupdate(d) 413 668 else: 669 if opts.verbose: 670 print "update(nsupdate): %s" % d 414 671 call_nsupdate(d) 672 673 if rebuild_cache: 674 (file_dir, file_name) = os.path.split(dns_update_cache) 675 (tmp_fd, tmpfile) = tempfile.mkstemp(dir=file_dir, prefix=file_name, suffix="XXXXXX") 676 wfile = os.fdopen(tmp_fd, 'a') 677 for d in dns_list: 678 wfile.write(str(d)+"\n") 679 os.rename(tmpfile, dns_update_cache) 680 fcntl.lockf(cfile, fcntl.LOCK_UN) 415 681 416 682 # delete the ccache if we created it -
vendor/current/source4/scripting/bin/samba_spnupdate
r740 r988 4 4 # 5 5 # Copyright (C) Andrew Tridgell 2010 6 # Copyright (C) Matthieu Patou <mat@matws.net> 2012 6 7 # 7 8 # This program is free software; you can redistribute it and/or modify … … 19 20 20 21 21 import os, sys 22 import os, sys, re 22 23 23 24 # ensure we get messages out immediately, so they get in the samba logs, … … 71 72 vars = {} 72 73 73 vars['DNSDOMAIN'] = lp.get('realm').lower() 74 vars['HOSTNAME'] = lp.get('netbios name').lower() + "." + vars['DNSDOMAIN'] 74 vars['DNSDOMAIN'] = samdb.domain_dns_name() 75 vars['DNSFOREST'] = samdb.forest_dns_name() 76 vars['HOSTNAME'] = samdb.host_dns_name() 75 77 vars['NETBIOSNAME'] = lp.get('netbios name').upper() 76 78 vars['WORKGROUP'] = lp.get('workgroup') 77 79 vars['NTDSGUID'] = samdb.get_ntds_GUID() 78 res = samdb.search(base= None, scope=ldb.SCOPE_BASE, attrs=["objectGUID"])80 res = samdb.search(base=samdb.get_default_basedn(), scope=ldb.SCOPE_BASE, attrs=["objectGUID"]) 79 81 guid = samdb.schema_format_value("objectGUID", res[0]['objectGUID'][0]) 80 82 vars['DOMAINGUID'] = guid … … 83 85 try: 84 86 private_dir = lp.get("private dir") 85 secrets_path = os.path.join(private_dir, lp.get("secrets database"))87 secrets_path = os.path.join(private_dir, "secrets.ldb") 86 88 87 89 secrets_db = Ldb(url=secrets_path, session_info=system_session(), … … 104 106 credentials = None 105 107 106 samdb = SamDB(url=lp. get("sam database"), session_info=system_session(), credentials=credentials, lp=lp)108 samdb = SamDB(url=lp.samdb_url(), session_info=system_session(), credentials=credentials, lp=lp) 107 109 except ldb.LdbError, (num, msg): 108 print("Unable to open sam database %s : %s" % (lp. get("sam database"), msg))110 print("Unable to open sam database %s : %s" % (lp.samdb_url(), msg)) 109 111 sys.exit(1) 110 112 … … 119 121 120 122 spn_list = [] 123 124 has_forest_dns = False 125 has_domain_dns = False 126 # check if we "are DNS server" 127 res = samdb.search(base=samdb.get_config_basedn(), 128 expression='(objectguid=%s)' % sub_vars['NTDSGUID'], 129 attrs=["msDS-hasMasterNCs"]) 130 131 basedn = str(samdb.get_default_basedn()) 132 if len(res) == 1: 133 if "msDS-hasMasterNCs" in res[0]: 134 for e in res[0]["msDS-hasMasterNCs"]: 135 if str(e) == "DC=DomainDnsZones,%s" % basedn: 136 has_domain_dns = True 137 if str(e) == "DC=ForestDnsZones,%s" % basedn: 138 has_forest_dns = True 139 121 140 122 141 # build the spn list … … 125 144 if line == '' or line[0] == "#": 126 145 continue 146 if re.match(r".*/DomainDnsZones\..*", line) and not has_domain_dns: 147 continue 148 if re.match(r".*/ForestDnsZones\..*", line) and not has_forest_dns: 149 continue 127 150 line = samba.substitute_var(line, sub_vars) 128 151 spn_list.append(line) 129 152 130 153 # get the current list of SPNs in our sam 131 res = samdb.search(base= "",154 res = samdb.search(base=samdb.get_default_basedn(), 132 155 expression='(&(objectClass=computer)(samaccountname=%s$))' % sub_vars['NETBIOSNAME'], 133 156 attrs=["servicePrincipalName"]) … … 190 213 net = Net(creds=creds, lp=lp) 191 214 try: 192 cldap_ret = net.finddc(domain ,nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)215 cldap_ret = net.finddc(domain=domain, flags=nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE) 193 216 except Exception, reason: 194 217 print("Unable to find writeable DC for domain '%s' to send DRS writeSPN to : %s" % (domain, reason)) … … 197 220 try: 198 221 binding_options = "seal" 199 if lp.get("log level") >= 5:222 if int(lp.get("log level")) >= 5: 200 223 binding_options += ",print" 201 224 drs = drsuapi.drsuapi('ncacn_ip_tcp:%s[%s]' % (server, binding_options), lp, creds) … … 221 244 req1.spn_names = spn_names 222 245 (level, res) = drs.DsWriteAccountSpn(drs_handle, 1, req1) 246 if (res.status != (0, 'WERR_OK')): 247 print "WriteAccountSpn has failed with error %s" % str(res.status) 223 248 224 249 if samdb.am_rodc(): -
vendor/current/source4/scripting/bin/setup_dns.sh
r740 r988 14 14 15 15 [ -z "$PRIVATEDIR" ] && { 16 PRIVATEDIR=$(bin/ testparm --section-name=global --parameter-name='private dir' --suppress-prompt 2> /dev/null)16 PRIVATEDIR=$(bin/samba-tool testparm --section-name=global --parameter-name='private dir' --suppress-prompt 2> /dev/null) 17 17 } 18 18 19 19 OBJECTGUID=$(bin/ldbsearch -s base -H "$PRIVATEDIR/sam.ldb" -b "CN=NTDS Settings,CN=$HOSTNAME,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=$RSUFFIX" objectguid|grep ^objectGUID| cut -d: -f2) 20 20 21 samba4kinit=kinit 22 if test -x $BINDIR/samba4kinit; then 23 samba4kinit=bin/samba4kinit 24 fi 25 21 26 echo "Found objectGUID $OBJECTGUID" 22 27 23 28 echo "Running kinit for $HOSTNAME\$@$DOMAIN" 24 bin/samba4kinit -e arcfour-hmac-md5 -k -t "$PRIVATEDIR/secrets.keytab" $HOSTNAME\$@$DOMAIN || exit 129 $samba4kinit -e arcfour-hmac-md5 -k -t "$PRIVATEDIR/secrets.keytab" $HOSTNAME\$@$DOMAIN || exit 1 25 30 echo "Adding $HOSTNAME.$DOMAIN" 26 31 scripting/bin/nsupdate-gss --noverify $HOSTNAME $DOMAIN $IP 300 || { -
vendor/current/source4/scripting/bin/smbstatus
r740 r988 3 3 # 4 4 # provide information on connected users and open files 5 # Copyright ÇJelmer Vernooij 20085 # Copyright (c) Jelmer Vernooij 2008 6 6 # 7 7 # Based on the original in EJS: … … 12 12 import os, sys 13 13 14 # make sure the script dies immediately when hitting control-C, 15 # rather than raising KeyboardInterrupt. As we do all database 16 # operations using transactions, this is safe. 17 import signal 18 signal.signal(signal.SIGINT, signal.SIG_DFL) 19 14 20 sys.path.insert(0, "bin/python") 15 21 … … 19 25 20 26 def show_sessions(conn): 21 27 """show open sessions""" 22 28 23 24 25 26 27 28 29 29 sessions = conn.smbsrv_information(irpc.SMBSRV_INFO_SESSIONS).next() 30 print "User Client Connected at" 31 print "-" * 79 32 for session in sessions: 33 fulluser = "%s/%s" % (session.account_name, session.domain_name) 34 print "%-30s %16s %s" % (fulluser, session.client_ip, sys.httptime(session.connect_time)) 35 print "" 30 36 31 37 def show_tcons(open_connection): 32 33 34 35 36 37 38 38 """show open tree connects""" 39 conn = open_connection("smb_server") 40 tcons = conn.smbsrv_information(irpc.SMBSRV_INFO_TCONS).next() 41 print "Share Client Connected at" 42 print "-" * 79 43 for tcon in tcons: 44 print "%-30s %16s %s" % (tcon.share_name, tcon.client_ip, sys.httptime(tcon.connect_time)) 39 45 40 46 41 47 def show_nbt(open_connection): 42 43 44 45 46 47 48 49 50 51 52 53 48 """show nbtd information""" 49 conn = open_connection("nbt_server") 50 stats = conn.nbtd_information(irpc.NBTD_INFO_STATISTICS).next() 51 print "NBT server statistics:" 52 fields = [("total_received", "Total received"), 53 ("total_sent", "Total sent"), 54 ("query_count", "Query count"), 55 ("register_count", "Register count"), 56 ("release_count", "Release count")] 57 for (field, description) in fields: 58 print "\t%s:\t%s" % (description, getattr(stats, field)) 59 print 54 60 55 61 parser = optparse.OptionParser("%s [options]" % sys.argv[0]) … … 57 63 parser.add_option_group(sambaopts) 58 64 parser.add_option("--messaging-path", type="string", metavar="PATH", 59 65 help="messaging path") 60 66 parser.add_option("--nbt", help="show NetBIOS status", action="store_true") 61 67 … … 69 75 70 76 def open_connection(name): 71 77 return messaging.ClientConnection(name, messaging_path=messaging_path) 72 78 73 79 if opts.nbt: 74 80 show_nbt(open_connection) 75 81 else: 76 77 78 79 80 81 82 83 82 try: 83 conn = open_connection("smb_server") 84 except RuntimeError, (num, msg): 85 if msg == 'NT_STATUS_OBJECT_NAME_NOT_FOUND': 86 print "No active connections" 87 else: 88 show_sessions(conn) 89 show_tcons(conn) -
vendor/current/source4/scripting/bin/subunitrun
r740 r988 2 2 3 3 # Simple subunit testrunner for python 4 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007 5 # 4 5 # NOTE: This is deprecated - Using the standard subunit runner is 6 # preferred - e.g. "python -m samba.subunit.run YOURMODULE". 7 # 8 # This wrapper will be removed once all tests can be run 9 # without it. At the moment there are various tests which still 10 # get e.g. credentials passed via command-line options to this 11 # script. 12 13 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2014 14 # 6 15 # This program is free software; you can redistribute it and/or modify 7 16 # it under the terms of the GNU General Public License as published by 8 17 # the Free Software Foundation; either version 3 of the License, or 9 18 # (at your option) any later version. 10 # 19 # 11 20 # This program is distributed in the hope that it will be useful, 12 21 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 23 # GNU General Public License for more details. 15 # 24 # 16 25 # You should have received a copy of the GNU General Public License 17 26 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 20 29 import sys 21 30 31 # make sure the script dies immediately when hitting control-C, 32 # rather than raising KeyboardInterrupt. As we do all database 33 # operations using transactions, this is safe. 34 import signal 35 signal.signal(signal.SIGINT, signal.SIG_DFL) 36 22 37 # Find right directory when running from source tree 23 38 sys.path.insert(0, "bin/python") … … 25 40 import optparse 26 41 import samba 27 samba.ensure_external_module("testtools", "testtools") 28 samba.ensure_external_module("subunit", "subunit/python") 29 from subunit.run import SubunitTestRunner 42 from samba.tests.subunitrun import TestProgram, SubunitOptions 43 30 44 import samba.getopt as options 31 45 import samba.tests 32 46 33 47 34 parser = optparse.OptionParser("subunitrun [options] <tests>") 48 usage = 'subunitrun [options] <tests>' 49 description = ''' 50 This runs a Samba python test suite. The tests are typically located in 51 python/samba/tests/*.py 52 53 To run the tests from one of those modules, specify the test as 54 samba.tests.MODULE. For example, to run the tests in common.py: 55 56 subunitrun samba.tests.common 57 58 To list the tests in that module, use: 59 60 subunitrun -l samba.tests.common 61 62 NOTE: This script is deprecated in favor of "python -m subunit.run". Don't use 63 it unless it can be avoided. 64 ''' 65 66 def format_description(formatter): 67 '''hack to prevent textwrap of the description''' 68 return description 69 70 parser = optparse.OptionParser(usage=usage, description=description) 71 parser.format_description = format_description 35 72 credopts = options.CredentialsOptions(parser) 73 sambaopts = options.SambaOptions(parser) 74 subunitopts = SubunitOptions(parser) 36 75 parser.add_option_group(credopts) 37 try: 38 from subunit.run import TestProgram 39 except ImportError: 40 from unittest import TestProgram 41 else: 42 parser.add_option('-l', '--list', dest='listtests', default=False, 43 help='List tests rather than running them.', 44 action="store_true") 76 parser.add_option_group(sambaopts) 77 parser.add_option_group(subunitopts) 45 78 46 79 opts, args = parser.parse_args() 47 80 48 samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.env_loadparm()) 49 if getattr(opts, "listtests", False): 50 args.insert(0, "--list") 81 if not getattr(opts, "listtests", False): 82 lp = sambaopts.get_loadparm() 83 samba.tests.cmdline_credentials = credopts.get_credentials(lp) 84 if getattr(opts, 'load_list', None): 85 args.insert(0, "--load-list=%s" % opts.load_list) 51 86 52 runner = SubunitTestRunner() 53 program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner) 87 TestProgram(module=None, args=args, opts=subunitopts) -
vendor/current/source4/scripting/devel/chgtdcpass
r740 r988 30 30 from samba.auth import system_session 31 31 from samba import param 32 from samba.provision import find_provision_key_parameters 32 33 from samba.upgradehelpers import (get_paths, 33 find_provision_key_parameters,get_ldbs,34 get_ldbs, 34 35 update_machine_account_password) 35 36 -
vendor/current/source4/scripting/devel/drs/vampire_ad.sh
r740 r988 24 24 REALM="$(echo $DNSDOMAIN | tr '[a-z]' '[A-Z]')" 25 25 26 sudo $GDB bin/samba-tool join $DNSDOMAIN DC -Uadministrator%$pass -s $PREFIX/etc/smb.conf --option=realm=$REALM --option="ads:dc function level=4" --option="ads:min function level=0" -d2 "$@" || exit 126 sudo $GDB bin/samba-tool domain join $DNSDOMAIN DC -Uadministrator%$pass -s $PREFIX/etc/smb.conf --option=realm=$REALM --option="ads:dc function level=4" --option="ads:min function level=0" -d2 "$@" || exit 1 27 27 # PRIVATEDIR=$PREFIX/private sudo -E scripting/bin/setup_dns.sh $machine $DNSDOMAIN $machine_ip || exit 1 28 28 #sudo rndc flush -
vendor/current/source4/scripting/devel/getncchanges
r740 r988 14 14 from samba.samdb import SamDB 15 15 from samba.auth import system_session 16 from samba.ndr import ndr_unpack 16 17 17 18 def do_DsBind(drs): … … 101 102 parser.add_option("", "--exop", dest="exop", help="extended operation",) 102 103 parser.add_option("", "--pas", dest="use_pas", action='store_true', default=False, 103 help="send partial attribute set",) 104 parser.add_option("", "--dest-dsa", type='str', 105 default='"9c637462-5b8c-4467-aef2-bdb1f57bc4ef"', help="destination DSA GUID") 104 help="send partial attribute set (for RODC)") 105 parser.add_option("", "--nb-iter", type='int', help="Number of getncchange iterations") 106 parser.add_option("", "--dest-dsa", type='str', help="destination DSA GUID") 107 parser.add_option("", "--rodc", action='store_true', default=False, 108 help='use RODC replica flags') 109 parser.add_option("", "--partial-rw", action='store_true', default=False, 110 help='use RW partial replica flags, not be confused with --pas') 106 111 parser.add_option("", "--replica-flags", type='int', 107 112 default=drsuapi.DRSUAPI_DRS_INIT_SYNC | 108 113 drsuapi.DRSUAPI_DRS_PER_SYNC | 114 drsuapi.DRSUAPI_DRS_WRIT_REP | 109 115 drsuapi.DRSUAPI_DRS_GET_ANC | 110 116 drsuapi.DRSUAPI_DRS_NEVER_SYNCED, … … 112 118 113 119 (opts, args) = parser.parse_args() 120 if opts.rodc: 121 opts.replica_flags = drsuapi.DRSUAPI_DRS_INIT_SYNC |\ 122 drsuapi.DRSUAPI_DRS_PER_SYNC |\ 123 drsuapi.DRSUAPI_DRS_GET_ANC |\ 124 drsuapi.DRSUAPI_DRS_NEVER_SYNCED |\ 125 drsuapi.DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING |\ 126 drsuapi.DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP 127 128 if opts.partial_rw: 129 opts.replica_flags = drsuapi.DRSUAPI_DRS_INIT_SYNC |\ 130 drsuapi.DRSUAPI_DRS_PER_SYNC |\ 131 drsuapi.DRSUAPI_DRS_GET_ANC |\ 132 drsuapi.DRSUAPI_DRS_NEVER_SYNCED 114 133 115 134 lp = sambaopts.get_loadparm() … … 121 140 if creds.is_anonymous(): 122 141 parser.error("You must supply credentials") 142 143 if opts.partial_rw and opts.rodc: 144 parser.error("Can't specify --partial-rw and --rodc") 123 145 124 146 server = args[0] … … 148 170 exop = int(opts.exop) 149 171 172 dest_dsa = opts.dest_dsa 173 if not dest_dsa: 174 print "no dest_dsa specified trying to figure out from ldap" 175 msgs = samdb.search(controls=["search_options:1:2"], 176 expression='(objectclass=ntdsdsa)') 177 if len(msgs) == 1: 178 dest_dsa = str(ndr_unpack(misc.GUID, msgs[0]["invocationId"][0])) 179 print "Found this dsa: %s" % dest_dsa 180 else: 181 # TODO fixme 182 pass 183 if not dest_dsa: 184 print "Unable to find the dest_dsa automatically please specify it" 185 import sys 186 sys.exit(1) 187 150 188 null_guid = misc.GUID() 151 req8.destination_dsa_guid = misc.GUID( opts.dest_dsa)189 req8.destination_dsa_guid = misc.GUID(dest_dsa) 152 190 req8.source_dsa_invocation_id = misc.GUID(samdb.get_invocation_id()) 153 191 req8.naming_context = drsuapi.DsReplicaObjectIdentifier() … … 171 209 req8.mapping_ctr.mappings = None 172 210 211 nb_iter = 0 173 212 while True: 174 213 (level, ctr) = drs.DsGetNCChanges(drs_handle, 8, req8) 175 if ctr.more_data == 0: 214 nb_iter += 1 215 if ctr.more_data == 0 or opts.nb_iter == nb_iter: 176 216 break 177 req8.highwatermark .tmp_highest_usn = ctr.new_highwatermark.tmp_highest_usn217 req8.highwatermark = ctr.new_highwatermark -
vendor/current/source4/scripting/devel/selftest-vars.sh
r740 r988 3 3 4 4 export UID_WRAPPER=1 5 export NSS_WRAPPER_PASSWD=st/dc/passwd 6 export NSS_WRAPPER_GROUP=st/dc/group 7 export CONFIGURATION="--configfile=$PWD/st/dc/etc/smb.conf" 5 export NSS_WRAPPER_PASSWD=$PWD/st/ad_dc_ntvfs/passwd 6 export NSS_WRAPPER_GROUP=$PWD/st/ad_dc_ntvfs/group 7 export CONFIGURATION="--configfile=$PWD/st/ad_dc_ntvfs/etc/smb.conf" 8 export VAMPIRE_DC_SERVER=localvampiredc 9 export VAMPIRE_DC_SERVER_IP=127.0.0.22 10 export VAMPIRE_DC_NETBIOSNAME=localvampiredc1 11 export VAMPIRE_DC_NETBIOSALIAS=localvampiredc 8 12 export MEMBER_SERVER=localmember3 9 export MEMBER_SERVER_IP=127.0.0. 313 export MEMBER_SERVER_IP=127.0.0.23 10 14 export MEMBER_NETBIOSNAME=localmember3 11 15 export MEMBER_NETBIOSALIAS=localmember 12 16 export RPC_PROXY_SERVER=localrpcproxy4 13 export RPC_PROXY_SERVER_IP=127.0.0. 417 export RPC_PROXY_SERVER_IP=127.0.0.24 14 18 export RPC_PROXY_NETBIOSNAME=localrpcproxy4 15 19 export RPC_PROXY_NETBIOSALIAS=localrpcproxy 16 export SELFTEST_TARGET="samba4"17 20 export SELFTEST_MAXTIME=1200 18 21 export NETBIOSNAME=localdc1 19 22 export REALM=SAMBA.EXAMPLE.COM 20 export SOCKET_WRAPPER_DEFAULT_IFACE= 123 export SOCKET_WRAPPER_DEFAULT_IFACE=21 21 24 export SERVER=localdc1 22 export WINBINDD_SOCKET_DIR=$PWD/st/dc/winbindd_socket25 export SELFTEST_WINBINDD_SOCKET_DIR=$PWD/st/ad_dc_ntvfs/winbindd_socket 23 26 export SELFTEST_PREFIX=$PWD/st 24 27 export DOMAIN=SAMBADOMAIN 25 export B UILDDIR=.26 export DC_SERVER_IP=127.0.0. 128 export BINDIR=./bin 29 export DC_SERVER_IP=127.0.0.21 27 30 export SELFTEST_INTERFACES=127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8 28 31 export SOCKET_WRAPPER_DIR=$PWD/st/w 29 32 export DC_USERNAME=Administrator 30 33 export USERNAME=Administrator 31 export SERVER_IP=127.0.0. 132 export KRB5_CONFIG=$PWD/st/ dc/etc/krb5.conf34 export SERVER_IP=127.0.0.21 35 export KRB5_CONFIG=$PWD/st/ad_dc_ntvfs/etc/krb5.conf 33 36 export PREFIX_ABS=$PWD/st 34 37 export SRCDIR_ABS=$PWD 35 export PREFIX= ./st36 export KRB5CCNAME= ./st/krb5ticket37 export SRCDIR= .38 export PREFIX=$PWD/st 39 export KRB5CCNAME=$PWD/st/krb5ticket 40 export SRCDIR=$PWD/ 38 41 export TLS_ENABLED=yes 39 42 export DC_NETBIOSALIAS=localdc … … 44 47 export PASSWORD=locDCpass1 45 48 export NETBIOSALIAS=localdc 46 export SMB_CONF_PATH=$PWD/st/ dc/etc/smb.conf49 export SMB_CONF_PATH=$PWD/st/ad_dc_ntvfs/etc/smb.conf -
vendor/current/source4/scripting/devel/speedtest.py
r740 r988 31 31 sys.path.insert(0, "bin/python") 32 32 import samba 33 samba.ensure_external_module("testtools", "testtools") 34 samba.ensure_external_module("subunit", "subunit/python") 33 from samba.tests.subunitrun import TestProgram, SubunitOptions 35 34 36 35 import samba.getopt as options 37 36 38 from ldb import ( 39 SCOPE_BASE, SCOPE_SUBTREE, LdbError, ERR_NO_SUCH_OBJECT, 40 ERR_UNWILLING_TO_PERFORM, ERR_INSUFFICIENT_ACCESS_RIGHTS) 41 from samba.ndr import ndr_pack, ndr_unpack 37 from ldb import SCOPE_BASE, SCOPE_SUBTREE 38 from samba.ndr import ndr_unpack 42 39 from samba.dcerpc import security 43 40 … … 48 45 import samba.tests 49 46 from samba.tests import delete_force 50 from subunit.run import SubunitTestRunner51 import unittest52 47 53 48 parser = optparse.OptionParser("speedtest.py [options] <host>") … … 56 51 parser.add_option_group(options.VersionOptions(parser)) 57 52 58 59 53 # use command line creds if available 60 54 credopts = options.CredentialsOptions(parser) 61 55 parser.add_option_group(credopts) 56 subunitopts = SubunitOptions(parser) 57 parser.add_option_group(subunitopts) 62 58 opts, args = parser.parse_args() 63 59 … … 233 229 ldb = SamDB(host, credentials=creds, session_info=system_session(), lp=lp, options=ldb_options) 234 230 235 runner = SubunitTestRunner() 236 rc = 0 237 if not runner.run(unittest.makeSuite(SpeedTestAddDel)).wasSuccessful(): 238 rc = 1 239 if not runner.run(unittest.makeSuite(AclSearchSpeedTest)).wasSuccessful(): 240 rc = 1 241 sys.exit(rc) 231 TestProgram(module=__name__, opts=subunitopts) -
vendor/current/source4/scripting/wscript_build
r740 r988 3 3 from samba_utils import MODE_755 4 4 5 bld.INSTALL_FILES('${SBINDIR}','bin/upgradeprovision bin/samba_dnsupdate bin/samba_spnupdate', 5 sbin_files = None 6 if bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'): 7 sbin_files = 'bin/samba_dnsupdate bin/samba_spnupdate bin/samba_upgradedns bin/samba_kcc' 8 9 if sbin_files: 10 bld.INSTALL_FILES('${SBINDIR}', 11 sbin_files, 12 chmod=MODE_755, python_fixup=True, flat=True) 13 14 if bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'): 15 bld.INSTALL_FILES('${BINDIR}', 16 'bin/samba-tool', 6 17 chmod=MODE_755, python_fixup=True, flat=True) 7 bld.INSTALL_FILES('${BINDIR}','bin/testparm', 8 chmod=MODE_755, python_fixup=True, flat=True)18 19 bld.RECURSE('bin')
Note:
See TracChangeset
for help on using the changeset viewer.