The Samba-Bugzilla – Attachment 7030 Details for
Bug 8544
samba-tool user subcommands (add and setpassword) doesn't support random passwords
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch adds random password capability to the relevant samba-tool user subcommands
samba-tool.diff (text/plain), 3.04 KB, created by
Geza Gemes (dead mail address)
on 2011-10-25 15:27:19 UTC
(
hide
)
Description:
The patch adds random password capability to the relevant samba-tool user subcommands
Filename:
MIME Type:
Creator:
Geza Gemes (dead mail address)
Created:
2011-10-25 15:27:19 UTC
Size:
3.04 KB
patch
obsolete
>diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py >index cbac5af..b1018d0 100644 >--- a/source4/scripting/python/samba/netcmd/user.py >+++ b/source4/scripting/python/samba/netcmd/user.py >@@ -25,7 +25,7 @@ import sys, ldb > from getpass import getpass > from samba.auth import system_session > from samba.samdb import SamDB >-from samba import gensec >+from samba import gensec, _glue > from samba.net import Net > > from samba.netcmd import ( >@@ -35,6 +35,7 @@ from samba.netcmd import ( > Option, > ) > >+generate_random_password = _glue.generate_random_password > > class cmd_user_add(Command): > """Creates a new user""" >@@ -47,6 +48,9 @@ class cmd_user_add(Command): > Option("--must-change-at-next-login", > help="Force password to be changed on next login", > action="store_true"), >+ Option("--random-password", >+ help="Generate random password", >+ action="store_true"), > Option("--use-username-as-cn", > help="Force use of username as user's CN", > action="store_true"), >@@ -73,12 +77,15 @@ class cmd_user_add(Command): > takes_args = ["username", "password?"] > > def run(self, username, password=None, credopts=None, sambaopts=None, >- versionopts=None, H=None, must_change_at_next_login=None, >+ versionopts=None, H=None, must_change_at_next_login=None, random_password=None, > use_username_as_cn=None, userou=None, surname=None, given_name=None, initials=None, > profile_path=None, script_path=None, home_drive=None, home_directory=None, > job_title=None, department=None, company=None, description=None, > mail_address=None, internet_address=None, telephone_number=None, physical_delivery_office=None): > >+ if random_password is not None: >+ password = generate_random_password(128, 255) >+ > while 1: > if password is not None and password is not '': > break >@@ -248,17 +255,24 @@ class cmd_user_setpassword(Command): > Option("--must-change-at-next-login", > help="Force password to be changed on next login", > action="store_true"), >+ Option("--random-password", >+ help="Generate random password", >+ action="store_true"), > ] > > takes_args = ["username?"] > > def run(self, username=None, filter=None, credopts=None, sambaopts=None, > versionopts=None, H=None, newpassword=None, >- must_change_at_next_login=None): >+ must_change_at_next_login=None, random_password=None): > if filter is None and username is None: > raise CommandError("Either the username or '--filter' must be specified!") > >- password = newpassword >+ if random_password is not None: >+ password = generate_random_password(128, 255) >+ else >+ password = newpassword >+ > while 1: > if password is not None and password is not '': > break
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8544
:
7022
|
7023
|
7030
|
7031
|
7033
|
7044