[PATCH] samba-tool 'user create' examples incorrect

Michael Adam obnox at samba.org
Sat Nov 21 15:52:36 UTC 2015


On 2015-11-21 at 09:09 +0000, Rowland Penny wrote:
> On 21/11/15 00:52, Michael Adam wrote:
> >On 2015-11-09 at 10:12 +0000, Rowland Penny wrote:
> >>Hi, the attached patch fixes a very small problem. If you run 'samba-tool
> >>user create --help' you get lines like this:
> >>
> >>Example5:
> >>samba-tool user add User5 passw5rd --nis-domain=samdom
> >>--unix-home=/home/User5
> >>
> >>Note that it uses 'add' instead of 'create', the attached patch fixes this.
> >Rowland,
> >
> >Thanks for the patch!
> >
> >The intended change itself is good, but a few cosmetic comments:
> >
> >- The patch changes line breaks in several places
> >   where no other change is done. Please avoid that.
> >   If you want to fix the formatting of the text,
> >   that should be a separate patch
> 
> As I understand it, the maximum line length is supposed to be 80 characters,
> so I thought that if I changed something, I was supposed to change the line
> length as well. From what you are saying now, If just changing a word, then
> just change the word and ignore the line length.

If you are also doing a content change, I'd say it's up
to you if you want to add the reformatting as a separate
change or in the same patch. Most of the times ist is
done in the same patch, but sometimes it increases
readability of the actual change to do saparate commits
(in one patchset).

But I thought the first few hunks only did line wraps...
See below.

Cheers - Michael

> >
> >- In those places where you add line breaks,
> >   you introduces some trailing spaces, which make
> >   git am complain. Please avoid those:
> 
> Will do
> 
> >$ git am /tmp/0001-samba-tool-user-create-examples-show-add-instead-of-.patch
> >Applying: samba-tool: user create examples show 'add' instead of 'create' Signed-off-by: Rowland Penny <repenny241155 at gmail.com>
> >/data/obnox/devel/samba/master-push.git/.git/rebase-apply/patch:14: trailing whitespace.
> >This command creates a new user account in the Active Directory domain.
> >/data/obnox/devel/samba/master-push.git/.git/rebase-apply/patch:18: trailing whitespace.
> >User accounts may represent physical entities, such as people or may be used as
> >/data/obnox/devel/samba/master-push.git/.git/rebase-apply/patch:19: trailing whitespace.
> >service accounts for applications.  User accounts are also referred to as
> >/data/obnox/devel/samba/master-push.git/.git/rebase-apply/patch:23: trailing whitespace.
> >A user account enables a user to logon to a computer and domain with an
> >/data/obnox/devel/samba/master-push.git/.git/rebase-apply/patch:24: trailing whitespace.
> >identity that can be authenticated.  To maximize security, each user should
> >warning: squelched 13 whitespace errors
> >warning: 18 lines add whitespace errors.
> >
> >
> >Cheers - Michael
> >
> 
> I will prepare another patch based on the recommendations.
> 
> Rowland
> >> From b32e91a0bb9f23983b3ebfecb9a946d6eda911a1 Mon Sep 17 00:00:00 2001
> >>From: Rowland Penny <repenny241155 at gmail.com>
> >>Date: Mon, 9 Nov 2015 10:05:05 +0000
> >>Subject: [PATCH] samba-tool: user create examples show 'add' instead of
> >>  'create' Signed-off-by: Rowland Penny
> >>  <repenny241155 at gmail.com>
> >>
> >>---
> >>  python/samba/netcmd/user.py |   51 ++++++++++++++++++++++++++++++++-----------
> >>  1 file changed, 38 insertions(+), 13 deletions(-)
> >>
> >>diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
> >>index ec91a93..c6757e1 100644
> >>--- a/python/samba/netcmd/user.py
> >>+++ b/python/samba/netcmd/user.py
> >>@@ -41,39 +41,64 @@ from samba.netcmd import (
> >>  class cmd_user_create(Command):
> >>      """Create a new user.
> >>-This command creates a new user account in the Active Directory domain.  The username specified on the command is the sAMaccountName.
> >>+This command creates a new user account in the Active Directory domain.
> >>+The username specified on the command is the sAMaccountName.

^^^ only line break?


> >>-User accounts may represent physical entities, such as people or may be used as service accounts for applications.  User accounts are also referred to as security principals and are assigned a security identifier (SID).
> >>+User accounts may represent physical entities, such as people or may be used as
> >>+service accounts for applications.  User accounts are also referred to as
> >>+security principals and are assigned a security identifier (SID).

^^^ only line break?


> >>-A user account enables a user to logon to a computer and domain with an identity that can be authenticated.  To maximize security, each user should have their own unique user account and password.  A user's access to domain resources is based on permissions assigned to the user account.
> >>+A user account enables a user to logon to a computer and domain with an
> >>+identity that can be authenticated.  To maximize security, each user should
> >>+have their own unique user account and password.  A user's access to domain
> >>+resources is based on permissions assigned to the user account.

^^^ only line break?

> >>-Unix (RFC2307) attributes may be added to the user account. Attributes taken from NSS are obtained on the local machine. Explicitly given values override values obtained from NSS. Configure 'idmap_ldb:use rfc2307 = Yes' to use these attributes for UID/GID mapping.
> >>+Unix (RFC2307) attributes may be added to the user account. Attributes taken
> >>+from NSS are obtained on the local machine. Explicitly given values override
> >>+values obtained from NSS. Configure 'idmap_ldb:use rfc2307 = Yes' to use these
> >>+attributes for UID/GID mapping.

^^^ only line break?

> >>-The command may be run from the root userid or another authorized userid.  The -H or --URL= option can be used to execute the command against a remote server.
> >>+The command may be run from the root userid or another authorized userid.
> >>+The -H or --URL= option can be used to execute the command against a remote
> >>+server.

^^^ only line break?

from here on we also get real changes.

> >>  Example1:
> >>-samba-tool user add User1 passw0rd --given-name=John --surname=Smith --must-change-at-next-login -H ldap://samba.samdom.example.com -Uadministrator%passw1rd
> >>+samba-tool user create User1 passw0rd --given-name=John --surname=Smith \
> >>+    --must-change-at-next-login -H ldap://samba.samdom.example.com \
> >>+    -Uadministrator%passw1rd
> >>-Example1 shows how to create a new user in the domain against a remote LDAP server.  The -H parameter is used to specify the remote target server.  The -U option is used to pass the userid and password authorized to issue the command remotely.
> >>+Example1 shows how to create a new user in the domain against a remote LDAP
> >>+server.
> >>+The -H parameter is used to specify the remote target server.
> >>+The -U option is used to pass the userid and password authorized to issue the
> >>+command remotely.
> >>  Example2:
> >>-sudo samba-tool user add User2 passw2rd --given-name=Jane --surname=Doe --must-change-at-next-login
> >>+sudo samba-tool user create User2 passw2rd --given-name=Jane --surname=Doe \
> >>+    --must-change-at-next-login
> >>-Example2 shows how to create a new user in the domain against the local server.   sudo is used so a user may run the command as root.  In this example, after User2 is created, he/she will be forced to change their password when they logon.
> >>+Example2 shows how to create a new user in the domain against the local server.
> >>+sudo is used so a user may run the command as root. In this example, after
> >>+User2 is created, they will be forced to change their password when they logon.
> >>  Example3:
> >>-samba-tool user add User3 passw3rd --userou='OU=OrgUnit'
> >>+samba-tool user create User3 passw3rd --userou='OU=OrgUnit'
> >>  Example3 shows how to create a new user in the OrgUnit organizational unit.
> >>  Example4:
> >>  samba-tool user create User4 passw4rd --rfc2307-from-nss --gecos 'some text'
> >>-Example4 shows how to create a new user with Unix UID, GID and login-shell set from the local NSS and GECOS set to 'some text'.
> >>+Example4 shows how to create a new user with Unix UID, GID and login-shell set
> >>+from the local NSS and GECOS set to 'some text'.
> >>  Example5:
> >>-samba-tool user add User5 passw5rd --nis-domain=samdom --unix-home=/home/User5 \
> >>-           --uid-number=10005 --login-shell=/bin/false --gid-number=10000
> >>+samba-tool user create User5 passw5rd --nis-domain=samdom \
> >>+--unix-home=/home/User5 --uid-number=10005 --login-shell=/bin/false \
> >>+   --gid-number=10000
> >>+
> >>+Example5 shows how to create an RFC2307/NIS domain enabled user account. If
> >>+--nis-domain is set, then the other four parameters are mandatory.
> >>  Example5 shows how to create an RFC2307/NIS domain enabled user account. If
> >>  --nis-domain is set, then the other four parameters are mandatory.
> >>-- 
> >>1.7.10.4
> >>
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151121/b8e16e0f/signature.sig>


More information about the samba-technical mailing list