The branch, master has been updated
       via  088a259... s4:blackbox/test_kinit.sh - Test the new "net user add 
<user> [<password>]" syntax
       via  ce4c026... s4:net utility - make outprinted description comments 
more consistent
       via  b703481... s4:net utility - remove unixname parameter of 
samdb.newuser
       via  cde9ec4... s4:samdb python bindings - remove idmap creation stuff 
from this call
       via  544dc44... s4:net utility - add an optional password attribute to 
"net user add"
      from  6dfa851... s4:dsdb Provide an intelegent fallback if not CN=Subnets 
is found

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 088a25912e8c306a82805b51a15f3ebe1e015934
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Sun May 9 11:45:24 2010 +0200

    s4:blackbox/test_kinit.sh - Test the new "net user add <user> [<password>]" 
syntax

commit ce4c0261f69732917ac7401dd123a03d4c13b030
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Sun May 9 11:24:10 2010 +0200

    s4:net utility - make outprinted description comments more consistent
    
    I've added a [server connection needed] when commands won't work on the 
local
    SamDB.

commit b703481ef78b4f2234cf0d6c087c25fcbe3bd65c
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Sun May 9 10:57:03 2010 +0200

    s4:net utility - remove unixname parameter of samdb.newuser
    
    We don't handle the id mapping stuff manually anymore.

commit cde9ec4af673a658777596f56dcba055458a4b35
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Sun May 9 10:54:19 2010 +0200

    s4:samdb python bindings - remove idmap creation stuff from this call
    
    The id mapping should now be handled automatically by the s4 daemon.

commit 544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Sat May 8 00:48:33 2010 +0200

    s4:net utility - add an optional password attribute to "net user add"
    
    To make it behave similar to "net newuser".

-----------------------------------------------------------------------

Summary of changes:
 .../scripting/python/samba/netcmd/domainlevel.py   |    2 +-
 .../scripting/python/samba/netcmd/enableaccount.py |    2 +-
 source4/scripting/python/samba/netcmd/export.py    |    4 +-
 source4/scripting/python/samba/netcmd/fsmo.py      |    2 +-
 source4/scripting/python/samba/netcmd/join.py      |    2 +-
 source4/scripting/python/samba/netcmd/machinepw.py |    2 +-
 source4/scripting/python/samba/netcmd/newuser.py   |   15 ++++--------
 .../scripting/python/samba/netcmd/pwsettings.py    |    2 +-
 source4/scripting/python/samba/netcmd/setexpiry.py |    2 +-
 .../scripting/python/samba/netcmd/setpassword.py   |    2 +-
 source4/scripting/python/samba/netcmd/time.py      |    2 +-
 source4/scripting/python/samba/netcmd/user.py      |   10 +++++---
 source4/scripting/python/samba/netcmd/vampire.py   |    2 +-
 source4/scripting/python/samba/samdb.py            |   23 +-------------------
 source4/utils/net/net.c                            |    4 +-
 testprogs/blackbox/test_kinit.sh                   |    2 +-
 16 files changed, 27 insertions(+), 51 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/netcmd/domainlevel.py 
b/source4/scripting/python/samba/netcmd/domainlevel.py
index ecd835d..f7e67a2 100644
--- a/source4/scripting/python/samba/netcmd/domainlevel.py
+++ b/source4/scripting/python/samba/netcmd/domainlevel.py
@@ -47,7 +47,7 @@ from samba.dsdb import (
     )
 
 class cmd_domainlevel(Command):
-    """Raises domain and forest function levels."""
+    """Raises domain and forest function levels"""
 
     synopsis = "(show | raise <options>)"
 
diff --git a/source4/scripting/python/samba/netcmd/enableaccount.py 
b/source4/scripting/python/samba/netcmd/enableaccount.py
index 0e57b57..3849f60 100644
--- a/source4/scripting/python/samba/netcmd/enableaccount.py
+++ b/source4/scripting/python/samba/netcmd/enableaccount.py
@@ -27,7 +27,7 @@ from samba.netcmd import Command, CommandError, Option
 from samba.samdb import SamDB
 
 class cmd_enableaccount(Command):
-    """Enable an account."""
+    """Enables a user"""
 
     synopsis = "enableaccount [username] [options]"
 
diff --git a/source4/scripting/python/samba/netcmd/export.py 
b/source4/scripting/python/samba/netcmd/export.py
index 9f1ff3d..08fa4bf 100644
--- a/source4/scripting/python/samba/netcmd/export.py
+++ b/source4/scripting/python/samba/netcmd/export.py
@@ -28,7 +28,7 @@ from samba.netcmd import (
     )
 
 class cmd_export_keytab(Command):
-    """Dumps kerberos keys of the domain into a keytab."""
+    """Dumps kerberos keys of the domain into a keytab"""
     synopsis = "%prog export keytab <keytab>"
 
     takes_optiongroups = {
@@ -50,7 +50,7 @@ class cmd_export_keytab(Command):
 
 
 class cmd_export(SuperCommand):
-    """Dumps the sam of the domain we are joined to."""
+    """Dumps the sam of the domain we are joined to [server connection 
needed]"""
 
     subcommands = {}
     subcommands["keytab"] = cmd_export_keytab()
diff --git a/source4/scripting/python/samba/netcmd/fsmo.py 
b/source4/scripting/python/samba/netcmd/fsmo.py
index 6886020..6b421fa 100644
--- a/source4/scripting/python/samba/netcmd/fsmo.py
+++ b/source4/scripting/python/samba/netcmd/fsmo.py
@@ -32,7 +32,7 @@ from samba.netcmd import (
 from samba.samdb import SamDB
 
 class cmd_fsmo(Command):
-    """Makes the targer DC transfer or seize a fsmo role"""
+    """Makes the targer DC transfer or seize a fsmo role [server connection 
needed]"""
 
     synopsis = "(show | transfer <options> | seize <options>)"
 
diff --git a/source4/scripting/python/samba/netcmd/join.py 
b/source4/scripting/python/samba/netcmd/join.py
index 981161d..8438f75 100644
--- a/source4/scripting/python/samba/netcmd/join.py
+++ b/source4/scripting/python/samba/netcmd/join.py
@@ -26,7 +26,7 @@ from samba.dcerpc.netr import SEC_CHAN_WKSTA, SEC_CHAN_BDC
 
 
 class cmd_join(Command):
-    """Joins domain as either member or backup domain controller."""
+    """Joins domain as either member or backup domain controller [server 
connection needed]"""
 
     synopsis = "%prog join <domain> [BDC | MEMBER] [options]"
 
diff --git a/source4/scripting/python/samba/netcmd/machinepw.py 
b/source4/scripting/python/samba/netcmd/machinepw.py
index 8788e06..f156f97 100644
--- a/source4/scripting/python/samba/netcmd/machinepw.py
+++ b/source4/scripting/python/samba/netcmd/machinepw.py
@@ -25,7 +25,7 @@ from samba.netcmd import Command, CommandError
 
 
 class cmd_machinepw(Command):
-    """Get a machine password out of our SAM."""
+    """Gets a machine password out of our SAM"""
 
     synopsis = "%prog machinepw <accountname>"
 
diff --git a/source4/scripting/python/samba/netcmd/newuser.py 
b/source4/scripting/python/samba/netcmd/newuser.py
index 64b6d17..9ffc0e6 100644
--- a/source4/scripting/python/samba/netcmd/newuser.py
+++ b/source4/scripting/python/samba/netcmd/newuser.py
@@ -28,7 +28,7 @@ from samba.auth import system_session
 from samba.samdb import SamDB
 
 class cmd_newuser(Command):
-    """Create a new user."""
+    """Creates a new user"""
 
     synopsis = "newuser [options] <username> [<password>]"
 
@@ -40,7 +40,6 @@ class cmd_newuser(Command):
 
     takes_options = [
         Option("-H", help="LDB URL for database or target server", type=str),
-        Option("--unixname", help="Unix Username", type=str),
         Option("--must-change-at-next-login",
             help="Force password to be changed on next login",
             action="store_true"),
@@ -49,21 +48,17 @@ class cmd_newuser(Command):
     takes_args = ["username", "password?"]
 
     def run(self, username, password=None, credopts=None, sambaopts=None,
-            versionopts=None, H=None, unixname=None,
-            must_change_at_next_login=None):
+            versionopts=None, H=None, must_change_at_next_login=None):
         if password is None:
             password = getpass("New Password: ")
 
-        if unixname is None:
-            unixname = username
-
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp)
 
         try:
-            samdb = SamDB(url=H, session_info=system_session(), 
credentials=creds,
-                          lp=lp)
-            samdb.newuser(username, unixname, password,
+            samdb = SamDB(url=H, session_info=system_session(),
+                          credentials=creds, lp=lp)
+            samdb.newuser(username, password,
                           
force_password_change_at_next_login_req=must_change_at_next_login)
         except ldb.LdbError, (num, msg):
             print('Failed to create user "%s" : %s' % (username, msg))
diff --git a/source4/scripting/python/samba/netcmd/pwsettings.py 
b/source4/scripting/python/samba/netcmd/pwsettings.py
index 8748bc5..3030248 100644
--- a/source4/scripting/python/samba/netcmd/pwsettings.py
+++ b/source4/scripting/python/samba/netcmd/pwsettings.py
@@ -31,7 +31,7 @@ from samba.dcerpc.samr import DOMAIN_PASSWORD_COMPLEX
 from samba.netcmd import Command, CommandError, Option
 
 class cmd_pwsettings(Command):
-    """Sets password settings.
+    """Sets password settings
 
     Password complexity, history length, minimum password length, the minimum 
     and maximum password age) on a Samba4 server.
diff --git a/source4/scripting/python/samba/netcmd/setexpiry.py 
b/source4/scripting/python/samba/netcmd/setexpiry.py
index b95192a..c424c08 100644
--- a/source4/scripting/python/samba/netcmd/setexpiry.py
+++ b/source4/scripting/python/samba/netcmd/setexpiry.py
@@ -28,7 +28,7 @@ from samba.auth import system_session
 from samba.samdb import SamDB
 
 class cmd_setexpiry(Command):
-    """Set the expiration of a user account."""
+    """Sets the expiration of a user account"""
 
     synopsis = "setexpiry [username] [options]"
 
diff --git a/source4/scripting/python/samba/netcmd/setpassword.py 
b/source4/scripting/python/samba/netcmd/setpassword.py
index a1fe75c..098b3cb 100644
--- a/source4/scripting/python/samba/netcmd/setpassword.py
+++ b/source4/scripting/python/samba/netcmd/setpassword.py
@@ -28,7 +28,7 @@ from samba.auth import system_session
 from samba.samdb import SamDB
 
 class cmd_setpassword(Command):
-    """Change the password of a user."""
+    """(Re)sets the password on a user account"""
 
     synopsis = "setpassword [username] [options]"
 
diff --git a/source4/scripting/python/samba/netcmd/time.py 
b/source4/scripting/python/samba/netcmd/time.py
index 163887a..710f4b6 100644
--- a/source4/scripting/python/samba/netcmd/time.py
+++ b/source4/scripting/python/samba/netcmd/time.py
@@ -27,7 +27,7 @@ from samba.netcmd import (
     )
 
 class cmd_time(Command):
-    """Retrieve the time on a remote server."""
+    """Retrieve the time on a remote server [server connection needed]"""
     synopsis = "%prog time <server-name>"
 
     takes_optiongroups = {
diff --git a/source4/scripting/python/samba/netcmd/user.py 
b/source4/scripting/python/samba/netcmd/user.py
index 7597f46..bf63b49 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -29,7 +29,7 @@ from samba.netcmd import (
 
 class cmd_user_add(Command):
     """Create a new user."""
-    synopsis = "%prog user add <name>"
+    synopsis = "%prog user add <name> [<password>]"
 
     takes_optiongroups = {
         "sambaopts": options.SambaOptions,
@@ -37,13 +37,15 @@ class cmd_user_add(Command):
         "versionopts": options.VersionOptions,
         }
 
-    takes_args = ["name"]
+    takes_args = ["name", "password?"]
 
-    def run(self, name, credopts=None, sambaopts=None, versionopts=None):
+    def run(self, name, password=None, credopts=None, sambaopts=None, 
versionopts=None):
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp)
         net = Net(creds, lp)
         net.create_user(name)
+        if password is not None:
+            net.set_password(name, creds.get_domain(), password, creds)
 
 
 class cmd_user_delete(Command):
@@ -66,7 +68,7 @@ class cmd_user_delete(Command):
 
 
 class cmd_user(SuperCommand):
-    """User management."""
+    """User management [server connection needed]"""
 
     subcommands = {}
     subcommands["add"] = cmd_user_add()
diff --git a/source4/scripting/python/samba/netcmd/vampire.py 
b/source4/scripting/python/samba/netcmd/vampire.py
index fcf9694..ffcfbce 100644
--- a/source4/scripting/python/samba/netcmd/vampire.py
+++ b/source4/scripting/python/samba/netcmd/vampire.py
@@ -29,7 +29,7 @@ from samba.netcmd import (
     )
 
 class cmd_vampire(Command):
-    """Join and synchronise a remote AD domain to the local server."""
+    """Join and synchronise a remote AD domain to the local server [server 
connection needed]"""
     synopsis = "%prog vampire [options] <domain>"
 
     takes_optiongroups = {
diff --git a/source4/scripting/python/samba/samdb.py 
b/source4/scripting/python/samba/samdb.py
index dd3824d..991c678 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -109,15 +109,11 @@ pwdLastSet: 0
 """ % (user_dn)
         self.modify_ldif(mod)
 
-    def newuser(self, username, unixname, password,
+    def newuser(self, username, password,
                 force_password_change_at_next_login_req=False):
         """Adds a new user
 
-        Note: This call adds also the ID mapping for winbind; therefore it 
works
-        *only* on SAMBA 4.
-        
         :param username: Name of the new user
-        :param unixname: Name of the unix user to map to
         :param password: Password for the new user
         :param force_password_change_at_next_login_req: Force password change
         """
@@ -135,23 +131,6 @@ pwdLastSet: 0
             self.setpassword("(dn=" + user_dn + ")", password,
               force_password_change_at_next_login_req)
 
-            # Gets the user SID (for the account mapping setup)
-            res = self.search(user_dn, scope=ldb.SCOPE_BASE,
-                              expression="objectclass=*",
-                              attrs=["objectSid"])
-            assert len(res) == 1
-            user_sid = self.schema_format_value("objectSid", 
res[0]["objectSid"][0])
-            
-            try:
-                idmap = IDmapDB(lp=self.lp)
-
-                user = pwd.getpwnam(unixname)
-
-                # setup ID mapping for this UID
-                idmap.setup_name_mapping(user_sid, idmap.TYPE_UID, user[2])
-
-            except KeyError:
-                pass
         except:
             self.transaction_cancel()
             raise
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index 0354131..5727b53 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -196,8 +196,8 @@ int net_run_usage(struct net_context *ctx,
 
 /* main function table */
 static const struct net_functable net_functable[] = {
-       {"password", "change password\n", net_password, net_password_usage},
-       {"join", "join a domain\n", net_join, net_join_usage},
+       {"password", "Changes/Sets the password on a user account [server 
connection needed]\n", net_password, net_password_usage},
+       {"join", "Joins a domain [server connection needed]\n", net_join, 
net_join_usage},
        {"samdump", "dump the sam of a domain\n", net_samdump, 
net_samdump_usage},
        {"samsync", "synchronise into the local ldb the sam of an NT4 
domain\n", net_samsync_ldb, net_samsync_ldb_usage},
        {"drs", "Implements functionality offered by repadmin.exe utility in 
Windows\n", net_drs, net_drs_usage},
diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh
index 08e88ba..504d4f4 100755
--- a/testprogs/blackbox/test_kinit.sh
+++ b/testprogs/blackbox/test_kinit.sh
@@ -66,9 +66,9 @@ test_smbclient "Test login with kerberos ccache" 'ls' -k yes 
|| failed=`expr $fa
 testit "domain join with kerberos ccache" $VALGRIND $net join $DOMAIN 
$CONFIGURATION  -W "$DOMAIN" -k yes $@ || failed=`expr $failed + 1`
 testit "check time with kerberos ccache" $VALGRIND $net $CONFIGURATION -W 
"$DOMAIN" -k yes $@ time $SERVER || failed=`expr $failed + 1`
 
-testit "add user with kerberos ccache" $VALGRIND $net user add nettestuser 
$CONFIGURATION  -k yes $@ || failed=`expr $failed + 1`
 userpass=testp...@12%
 echo $USERPASS > ./tmpuserpassfile
+testit "add user with kerberos ccache" $VALGRIND $net user add nettestuser 
$USERPASS $CONFIGURATION  -k yes $@ || failed=`expr $failed + 1`
 
 echo "Getting defaultNamingContext"
 BASEDN=`$ldbsearch $options --basedn='' -H ldap://$SERVER -s base DUMMY=x 
defaultNamingContext | grep defaultNamingContext | awk '{print $2}'`


-- 
Samba Shared Repository

Reply via email to