diff options
author | Andrew Bartlett <abartlet@samba.org> | 2001-10-29 07:24:49 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2001-10-29 07:24:49 +0000 |
commit | 0db1899256517507fb5a441bd75725e3fcecc2e8 (patch) | |
tree | e18dd4aff4ca7c42fbad0d3f521974c329231040 /source3/lib | |
parent | ab5d5cfbe0aee4387ec7ae8805c69b31a1696435 (diff) | |
download | samba-0db1899256517507fb5a441bd75725e3fcecc2e8.tar.gz samba-0db1899256517507fb5a441bd75725e3fcecc2e8.tar.bz2 samba-0db1899256517507fb5a441bd75725e3fcecc2e8.zip |
This commit is number 2 of 4.
In particular this commit focuses on:
The guts of the moving about inside passdb.
While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.
----
These changes allow for the introduction of a large dose of 'const' to
the Samba tree.
There are a number of good reasons to do this:
- I want to allow the SAM_ACCOUNT structure to move from wasteful
pstrings and fstrings to allocated strings. We can't do that if
people are modifying these outputs, as they may well make
assumptions about getting pstrings and fstrings
- I want --with-pam_smbpass to compile with a slightly sane
volume of warnings, currently its pretty bad, even in 2.2
where is compiles at all.
- Tridge assures me that he no longer opposes 'const religion'
based on the ability to #define const the problem away.
- Changed Get_Pwnam(x,y) into two variants (so that the const
parameter can work correctly): - Get_Pwnam(const x) and
Get_Pwnam_Modify(x).
- Reworked smbd/chgpasswd.c to work with these mods, passing
around a 'struct passwd' rather than the modified username
passdb/
- Kill off disp_info stuff, it isn't used any more - Kill off
support for writing to the old smbpasswd format, it isn't relevent
to Samba 3.0
- Move around and modify the pdb_...() helper functions, adding
one that sets the last changed time to 'now' and that sets the
must change time appropriately.
- Remove the ugly forced update of the LCT- value in
pdb_smbpasswd. - Remove the implicit modification of the ACB
flags when both NT and LM passwords are set.
- Removed substation in pdb_getsampwnam output, as a single
password change will render them inoperable in any case (they
will be substituted and stored)
- Added a default RID to the init_sam_from_pw() function, based on
our rid algorithm.
- Added checks that an smbpasswd stored user has a uid-based RID.
- Fail to store tdb based users without a RID
lib/
- Change the substituion code to use global_myname if there is
no connection (and therefore no called name) at the present time.
(This used to be commit 8f607810eb24ed1157bbd2e896c2c167bc34d986)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/substitute.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 9b2713a674..5336eb947f 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -29,6 +29,7 @@ pstring samlogon_user=""; BOOL sam_logon_in_ssb = False; fstring remote_proto="UNKNOWN"; fstring remote_machine=""; +extern pstring global_myname; /******************************************************************* Given a pointer to a %$(NAME) expand it as an environment variable. @@ -136,8 +137,12 @@ static char *automount_server(char *user_name) /* use the local machine name as the default */ /* this will be the default if WITH_AUTOMOUNT is not used or fails */ - pstrcpy(server_name, local_machine); - + if (*local_machine) { + pstrcpy(server_name, local_machine); + } else { + pstrcpy(server_name, global_myname); + } + #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT)) if (lp_nis_home_map()) @@ -193,7 +198,13 @@ void standard_sub_basic(char *str) string_sub(p,"%D", tmp_str,l); break; case 'I' : string_sub(p,"%I", client_addr(),l); break; - case 'L' : string_sub(p,"%L", local_machine,l); break; + case 'L' : + if (*local_machine) { + string_sub(p,"%L", local_machine,l); + } else { + string_sub(p,"%L", global_myname,l); + } + break; case 'M' : string_sub(p,"%M", client_name(),l); break; case 'R' : string_sub(p,"%R", remote_proto,l); break; case 'T' : string_sub(p,"%T", timestring(False),l); break; |