Author: mimir
Date: 2004-08-10 14:58:31 +0000 (Tue, 10 Aug 2004)
New Revision: 1695
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1695&nolog=1
Log:
Searching for existing entry before updating isn't needed and in fact
hinders doing it right. We need changes _only_ to catch the right values
inside the backend.


rafal


Modified:
   trunk/source/utils/pdbedit.c

Changeset:
Modified: trunk/source/utils/pdbedit.c
===================================================================
--- trunk/source/utils/pdbedit.c        2004-08-10 14:54:39 UTC (rev 1694)
+++ trunk/source/utils/pdbedit.c        2004-08-10 14:58:31 UTC (rev 1695)
@@ -818,14 +818,11 @@
 
        if (!dom_name) return -1;
 
-       /* fetch existing password to fill the structure before
-          the changes themselves */
-       nt_status = in->pdb_gettrustpwnam(in, &trust, dom_name);
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               printf("Wrong domain name - seems non-existent!\n");
-               return -1;
-       }
-
+       /* unicode domain name */
+       trust.private.uni_name_len = strlen(dom_name);
+       push_ucs2(NULL, &trust.private.uni_name, dom_name, trust.private.uni_name_len,
+                 STR_TERMINATE);
+       
        /* domain sid */
        if (dom_sid) {
                /* copying sid to trust password structure */
@@ -844,6 +841,8 @@
        givenpass = getpass("password (type Enter to leave it untouched):");
        if (strlen(givenpass))
                strncpy(trust.private.pass, givenpass, FSTRING_LEN);
+       else
+               trust.private.pass[0] = '\0';
 
        /* last change time */
        lct = time(NULL);

Reply via email to