s4:scripts - Reintroduce "-H" parameter
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 21 Sep 2009 09:53:19 +0000 (11:53 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 21 Sep 2009 09:53:19 +0000 (11:53 +0200)
I removed it since on some scripts it was present, on others not - so I thought
it wouldn't be really needed. This was a bad decision (pointed out by abartlet).
So I reintroduce it on all scripts (to have consistent parameters).

source4/setup/domainlevel
source4/setup/enableaccount
source4/setup/newuser
source4/setup/pwsettings
source4/setup/setexpiry
source4/setup/setpassword

index b49150ff2dafad65a3c92fdc2790e1577bb9ed19..ceab735c8f88e3e83b099eeea28db3bae66ba16a 100755 (executable)
@@ -39,6 +39,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--quiet", help="Be quiet", action="store_true")
 parser.add_option("--forest",
   help="The forest function level (2000 | 2003 | 2008 | 2008_R2). We don't support the 2003 with mixed domains (NT4 DC support) level.", type=str)
@@ -60,8 +61,12 @@ if len(args) == 0:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
 
 domain_dn = SamDB.domain_dn(samdb)
 
index 0ca5b39faaaa6bd997993099e8005dd65400db37..f8f727c1ee2698fde68dd454dd82c1a3502395d4 100755 (executable)
@@ -36,6 +36,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--filter", help="LDAP Filter to set password on", type=str)
 
 opts, args = parser.parse_args()
@@ -54,6 +55,11 @@ if filter is None:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
+
 samdb.enable_account(filter)
index 10af55a458afe973a3af2c4942d6777f8c96b9eb..ef65d36dfb0389e5fd2e338756e0fe94c188828f 100755 (executable)
@@ -37,6 +37,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--unixname", help="Unix Username", type=str)
 parser.add_option("--must-change-at-next-login", help="Force password to be changed on next login", action="store_true")
 
@@ -58,6 +59,11 @@ if opts.unixname is None:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
+
 samdb.newuser(username, opts.unixname, password, force_password_change_at_next_login_req=opts.must_change_at_next_login)
index 6a5e18ef59767645cfc296f176987b300d96c4b1..0bb39d975761f7f5755acee3b4957eb89381723a 100755 (executable)
@@ -39,6 +39,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--quiet", help="Be quiet", action="store_true")
 parser.add_option("--complexity",
   help="The password complexity (on | off | default). Default is 'on'", type=str)
@@ -67,8 +68,12 @@ if len(args) == 0:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
 
 domain_dn = SamDB.domain_dn(samdb)
 res = samdb.search(domain_dn, scope=ldb.SCOPE_BASE,
index 1572555b8cfab5de7f22202ca2e21f43648c2443..57c46f4dff74cfe7b5600d8aa9aa0c64ed036d5c 100755 (executable)
@@ -37,6 +37,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--filter", help="LDAP Filter to set password on", type=str)
 parser.add_option("--days", help="Days to expiry", type=int)
 parser.add_option("--noexpiry", help="Password does never expire", action="store_true")
@@ -59,6 +60,11 @@ if filter is None:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
+
 samdb.setexpiry(filter, days*24*3600, no_expiry_req=opts.noexpiry)
index d8a2a1144acb343d8d906e758592d590e18a339b..c150f518ad02fb1724790f89f9f0e3c5ddb2ca9b 100755 (executable)
@@ -38,6 +38,7 @@ parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
 parser.add_option("--filter", help="LDAP Filter to set password on", type=str)
 parser.add_option("--newpassword", help="Set password", type=str)
 parser.add_option("--must-change-at-next-login", help="Force password to be changed on next login", action="store_true")
@@ -62,7 +63,12 @@ if filter is None:
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), 
-              credentials=creds, lp=lp)
+if opts.H is not None:
+       url = opts.H
+else:
+       url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
+
 samdb.setpassword(filter, password, force_password_change_at_next_login=opts.must_change_at_next_login)