1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-18 19:17:08 +03:00

134 Commits

Author SHA1 Message Date
Jim McDonough
655fb66b28 r14156: Fix coverity #114: free storage alloc'ed by sstring_sub() 2007-10-10 11:15:14 -05:00
Jim McDonough
a197b8c5cb r14155: Fix coverity #115: free storage alloc'ed by sstring_sub() 2007-10-10 11:15:14 -05:00
Jim McDonough
dbc0ff5544 r14153: Fix coverity #116: free storage alloc'ed by sstring_sub() 2007-10-10 11:15:14 -05:00
Jim McDonough
cf36f5949f r14152: Fix coverity #117: free storage alloc'ed by sstring_sub 2007-10-10 11:15:14 -05:00
Jim McDonough
6ff849f35a r14150: Fix coverity #118: not freeing alloc'ed storage returned from
sstring_sub().
2007-10-10 11:15:14 -05:00
Jim McDonough
2d7ba11ffb r14147: Fix coverity #119. alloc'ed memory returned not saved, so not freed.
Need to go back and correct the assumption that an "ldap xxx suffix"
parm must have an OU.
2007-10-10 11:15:13 -05:00
Jim McDonough
f75dad0325 r14135: Fix for Coverity #123: resource leak. Also rework much of the code to
make it cleaner.  There's still more to do on this...
2007-10-10 11:15:13 -05:00
Jim McDonough
2690f015be r14053: Implement Simo's suggestion: don't use /dev/null for a 'bad' path for
users/workstations
2007-10-10 11:11:08 -05:00
Volker Lendecke
c1ea48949d r14036: Ok, the last one generated a const warning. Also fix Coverity # 119.
net rpc vampire is ugly....

Volker
2007-10-10 11:11:07 -05:00
Volker Lendecke
9fe21fd032 r14035: Fix Coverity bug # 124 2007-10-10 11:11:07 -05:00
Jim McDonough
217d3fbe79 r13968: fix typo, caught by Guenther 2007-10-10 11:11:02 -05:00
Jim McDonough
f629f8a7b9 r13957: Based on patch from Richard Renard <richard.renard@idealx.com>:
Fix machine accounts (should not have valid shells) and users with no
home directory (were getting previous user's directory).
2007-10-10 11:11:01 -05:00
Jeremy Allison
1d710d06a2 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
2007-10-10 11:10:59 -05:00
Gerald Carter
6f1afa4acc r13590: * replace all pdb_init_sam[_talloc]() calls with samu_new()
* replace all pdb_{init,fill}_sam_pw() calls with samu_set_unix()
2007-10-10 11:10:16 -05:00
Gerald Carter
19b7593972 r13576: This is the beginnings of moving the SAM_ACCOUNT data structure
to make full use of the new talloc() interface.  Discussed with Volker
and Jeremy.

* remove the internal mem_ctx and simply use the talloc()
  structure as the context.
* replace the internal free_fn() with a talloc_destructor() function
* remove the unnecessary private nested structure
* rename SAM_ACCOUNT to 'struct samu' to indicate the current an
  upcoming changes.  Groups will most likely be replaced with a
  'struct samg' in the future.

Note that there are now passbd API changes.  And for the most
part, the wrapper functions remain the same.

While this code has been tested on tdb and ldap based Samba PDC's
as well as Samba member servers, there are probably still
some bugs.  The code also needs more testing under valgrind to
ensure it's not leaking memory.

But it's a start......
2007-10-10 11:10:15 -05:00
Volker Lendecke
bb40e544de r13494: Merge the stuff I've done in head the last days.
Volker
2007-10-10 11:10:06 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Lars Müller
f650e3bdaf r12986: Use d_fprintf(stderr, ...) for any error message in net.
All 'usage' messages are still printed to stdout.

Fix some compiler warnings for system() calls where we didn't used the
return code.  Add appropriate error messages and return with the error
code we got from system() or NT_STATUS_UNSUCCESSFUL.
2007-10-10 11:06:09 -05:00
Gerald Carter
939c3cb5d7 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
2007-10-10 11:04:48 -05:00
Günther Deschner
c270ae79b5 r8786: Fix amazing and long-standing bug where user-accounts are just crippled
accounts (accounts without AcctCtrl set) after a vampire-process.

New Accounts tend to hace no acb_info at all which means "0"
(ACB_NORMAL). Unless 0 becomes not 0 we don't do anything and set *no*
acctrl for normal users at all (!). Those crippled users now don't show
up in usrmgr since 3.0.20somethings ldap-routines now finally test if
the attribute is there.

Guenther
2007-10-10 11:00:17 -05:00
Günther Deschner
af1aa09cde r8396: fix some compile warnings.
Guenther
2007-10-10 11:00:04 -05:00
Jim McDonough
cb5634a305 r8189: commit vampire ldif patch, mostly from Don Watson (dwatson@us.ibm.com). Yes,
that's my copyright...that's just how we have to do things at big blue.

Adds subcommand to vampire to allow data to be put into an ldif file instead
of actually writing to the passdb.  See "net rpc help vampire" for usage
info.  This should be added to docs as well.
2007-10-10 10:58:18 -05:00
Jeremy Allison
9506b8e145 r7882: Looks like a large patch - but what it actually does is make Samba
safe for using our headers and linking with C++ modules. Stops us
from using C++ reserved keywords in our code.
Jeremy
2007-10-10 10:58:00 -05:00
Gerald Carter
318c3db4cb r7130: remove 'winbind enable local accounts' code from the 3.0 tree 2007-10-10 10:57:01 -05:00
Volker Lendecke
3493d9f383 r6263: Get rid of generate_wellknown_sids, they are const static and initializable
statically.

Volker
2007-10-10 10:56:33 -05:00
Tim Potter
ede9fd08cf r5909: Remove some unecessary casts. Patch from Jason Mader for bugzill #2468. 2007-10-10 10:56:08 -05:00
Günther Deschner
fdf9bdbbac r5349: After talking with Jerry, reverted the addition of account policies to
passdb in 3_0 (they are still in trunk).

Guenther
2007-10-10 10:55:38 -05:00
Günther Deschner
3d391ef149 r5264: Log with loglevel 0 when account-administration scripts fail.
Guenther
2007-10-10 10:55:35 -05:00
Günther Deschner
75af83dfcd r4925: Migrate Account Policies to passdb (esp. replicating ldapsam).
Does automated migration from account_policy.tdb v1 and v2 and offers a
pdbedit-Migration interface. Jerry, please feel free to revert that if
you have other plans.

Guenther
2007-10-10 10:55:08 -05:00
Günther Deschner
aecacf4d9c r4877: When vampiring account policy AP_LOCK_ACCOUNT_DURATION honour "Lockout
Duration: Forever".

Guenther
2007-10-10 10:55:06 -05:00
Jim McDonough
60c3a638e4 r4538: Fix bugzilla 2198, accounts which have password last set to 0 are getting
no passwords after vampire.  Set password last set field to now.
2007-10-10 10:53:46 -05:00
Günther Deschner
b209f97f24 r4353: Finally get length of munged_dial correct.
Guenther
2007-10-10 10:53:46 -05:00
Günther Deschner
98f3e3353d r4352: Base64-encode munged-dial with correct length in 'net rpc vampire'.
Guenther
2007-10-10 10:53:45 -05:00
Günther Deschner
0930ad6627 r4351: Vampire Logon-Hours. Update Logon-Hours only when they have changed.
Guenther
2007-10-10 10:53:45 -05:00
Jeremy Allison
efc1b688cf r4291: More *alloc fixes inspired by Albert Chin (china@thewrittenword.com).
Jeremy
2007-10-10 10:53:42 -05:00
Günther Deschner
721bf50d74 r4287: Vampire SAM_DELTA_DOMAIN_INFO.
Based on samba4-idl. The decoding of account-lockout-string is somewhat
experimental though.

Guenther
2007-10-10 10:53:41 -05:00
Günther Deschner
a03aa09568 r4130: add bad_password_count and logon_count to vampire (inspired by a patch
from Lars Mueller <lmuelle@suse.de>), just for completeness.

Note that though we have logon_count implemented in all pdb-backends but
never (for good reason!) update the counter.

Guenther
2007-10-10 10:53:35 -05:00
Günther Deschner
eb64eb9d57 r4127: vampire munged_dial.
Guenther
2007-10-10 10:53:35 -05:00
Jeremy Allison
620f2e608f r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
2007-10-10 10:53:32 -05:00
Tim Potter
7f161702fa r2835: Since we always have -I. and -I$(srcdir) in CFLAGS, we can get rid of
'..' from all #include preprocessor commands.   This fixes bugzilla #1880
where OpenVMS gets confused about the '.' characters.
2007-10-10 10:52:55 -05:00
Andrew Bartlett
6b629344c5 Make it possible to 'net rpc samdump' of any domain you are currently joined
to, despite any smb.conf settings.

Work to allow the same for 'net rpc vampire', but instead give a clear
error message on what is incorrect.

Andrew Bartlett
-
Andrew Bartlett
fcdc5efb1e Make more functions static, and remove duplication in the use of functions
in lib/smbpasswd.c that were exact duplicates of functions in passdb/passdb.c

(These should perhaps be pulled back out to smbpasswd.c, but that can occour
later).

Andrew Bartlett
-
Andrew Bartlett
f9e59f8bc0 JHT came up with a nasty (broken) torture case in preparing examples for
his book.

This prompted me to look at the code that reads the unix group list.  This
code did a lot of name -> uid -> name -> sid translations, which caused
problems.  Instead, we now do just name->sid

I also cleaned up some interfaces, and client tools.

Andrew Bartlett
-
Tim Potter
f899448348 Break out of samsync loop on error. -
Tim Potter
0c35ba2cd6 Fix error return path memory leaks in vampire code for creating users.
Display an error if we can't create a posix account for the user
(e.g no add user/machine script was specified; bug #323).
-
Tim Potter
d7bd3c1efb Use opt_target_workgroup instead of lp_workgroup() in vampire code so
we can override the value in smb.conf with the -w option.

Migrating accounts from another domain can now be done like:

# bin/net join bdc -w nt4dom -Uadministrator%password
# bin/net rpc vampire -w nt4dom -U administrator%password
-
Jeremy Allison
85907f02ce Turns out I had my packet sequences wrong for oplock break code.
I was storing the mid of the oplock break - I should have been
storing the mid from the open. There are thus 2 types of deferred
packet sequence returns - ones that increment the sequence number
(returns from oplock causing opens) and ones that don't (change notify
returns etc). Running with signing forced on does lead to some
interesting tests :-).
Jeremy.
-
Jeremy Allison
cb326c2dbf Cosmetic fix from waider@waider.ie.
Jeremy.
-
Jeremy Allison
0021c83ff6 Ensure all code paths set add_script.
Jeremy.
-
Tim Potter
f93528ba00 Fixup a bunch of printf-style functions and debugs to use unsigned long when
displaying pid_t, uid_t and gid_t values.  This removes a whole lot of warnings
on some of the 64-bit build farm machines as well as help us out when 64-bit
uid/gid/pid values come along.
-