summaryrefslogtreecommitdiff
path: root/source3/lib/substitute.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r11159: Added some const to fix warnings.Jeremy Allison1-2/+2
Jeremy. (This used to be commit de27b0eef2eb021f28e8bf300c4dd524e30fc7ed)
2007-10-10r8899: various compiler warning fixes reported by Jason Mader ↵Gerald Carter1-1/+1
<jason@ncac.gwu.edu> (This used to be commit d8ae9f2b3e5387ef2c4e84cd9c33f4a7c795b0d3)
2007-10-10r8686: Revert %LOGONSERVER%-substitution. The substition is done on the client,Günther Deschner1-8/+8
not on the server. We now preserve this windows variable (important for vampired setups) and correctly substitute only the "%L"s in strings like: "%LOGONSERVER% %L %lOgOnSeRvEr% %L". Guenther (This used to be commit dccf777f42ce1d3f788548842fb8a606bed5708c)
2007-10-10r8493: According to MSKB 141714 the %LOGONSERVER% variable should beGünther Deschner1-2/+7
substituted like our %L-variable. Guenther (This used to be commit 294fdbccba9835b6abe5f26f22a0a05adb27564e)
2007-10-10r6225: get rid of warnings from my compiler about nested externsHerb Lewis1-1/+2
(This used to be commit efea76ac71412f8622cd233912309e91b9ea52da)
2007-10-10r5174: ensure that we consistently use the current_user_info.smb_name vs. ↵Gerald Carter1-0/+12
smb_name when parsing smb.conf and reloading config files (This used to be commit be537eaebe84b2ccae089e5982263df8a96e7a5b)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-5/+5
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r3049: fixing some calls in the printing code to stanard_sub_basic(); fix ↵Gerald Carter1-3/+5
standard_sub_snum() to use the current user's gid; add some (snum == -1) checks to standard_sub_advanced() (This used to be commit 8c3fd1908d201e9891878ff4c3259ed9690dff97)
2007-10-10r647: fix for setting the called name to by our IP if the called name was ↵Gerald Carter1-6/+6
*SMBSERVER and *SMBSERV -- fixes issue with connecting to printers via \ip.ad.dr.ess\printer UNC path (This used to be commit 8ee268f0ed0c2f75ded9c2ddd66e0953f443c79e)
2004-03-19BUG 417: fix %UuGg variables expansion in include lines setging the ↵Gerald Carter1-0/+5
current_user_info struct in register_vuid() -- shouldn't be any more broken than we were (This used to be commit a90c3bd281e7a62bb8482e42aa3b674eeeb5995a)
2003-12-08working on bug 687; protect against null src strings in alloc_sub_basic()Gerald Carter1-0/+7
(This used to be commit 6cf91bce40f85879de00b9ce89ad9b5e04a50b35)
2003-11-07Implement %i-Macro for the locally used IP address. With this you can againVolker Lendecke1-0/+3
have virtual hosts with different configurations on a single smbd even on port 445. Volker (This used to be commit 3a7c8c4f0e7fcfc2e20e1ad5e4b8e3c215ef1f0d)
2003-11-05make sure that we expand %H (from vl); bug 612Gerald Carter1-0/+3
(This used to be commit a77f5924304d03d8033d1ef5f6526373f5b67aa3)
2003-10-22Put strcasecmp/strncasecmp on the banned list (except for needed callsJeremy Allison1-2/+2
in iconv.c and nsswitch/). Using them means you're not thinking about multibyte at all and I really want to discourage that. Jeremy. (This used to be commit d7e35dfb9283d560d0ed2ab231f36ed92767dace)
2003-09-05More tuning from cachegrind. Change most trim_string() calls to trim_char(0,Jeremy Allison1-3/+3
as that's what they do. Fix string_replace() to fast-path ascii. Jeremy. (This used to be commit f35e9a8b909d3c74be47083ccc4a4e91a14938db)
2003-08-28Fix bug found by tridge in 2.2.x. Ensure that %U substitution isJeremy Allison1-4/+17
restored on next valid packet if a logon fails. This has relevence if people are using su.exe within logon scripts ! Jeremy. (This used to be commit d405a93a9d3f9a1d93bb3289b00683fba3160bbe)
2003-08-20metze's autogenerate patch for version.hGerald Carter1-2/+2
(This used to be commit ae452e51b02672a56adf18aa7a7e365eeaba9272)
2003-07-27If we strupper_m after the alpha_strcpy() we know that it is less likalyAndrew Bartlett1-2/+2
to contain multibyte charcters, as these should have been stripped. Andrew Bartlett (This used to be commit 0f7c1dda222d583212b8be2febe95ce7e1c0ba24)
2003-07-03Removed strupper/strlower macros that automatically map to ↵Jeremy Allison1-6/+6
strupper_m/strlower_m. I really want people to think about when they're using multibyte strings. Jeremy. (This used to be commit ff222716a08af65d26ad842ce4c2841cc6540959)
2003-06-17Const fixes by metzeVolker Lendecke1-4/+4
Volker (This used to be commit c0e35f3be8a33f19823826c5a84c885764c62508)
2003-04-23Fix this for both *SMBSERVER and *SMBSERV as per comments in loadparm.c.Andrew Bartlett1-1/+9
Andrew Bartlett (This used to be commit c6d416541be5349254a63e30fa29b022516b094e)
2003-04-23Try to avoid setting *SMBSERVER as a 'local name'.Andrew Bartlett1-0/+3
Andrew Bartlett (This used to be commit 5b5e167bb1a760a4f9c603feea886ce1dab52e19)
2003-03-18Add an extra parameter to our 'set_remote_machine_name' andAndrew Bartlett1-2/+29
'set_local_machine_name' so that the client can't change it from under us. (.NET RC2 and WinXP install calls the machine 'machinename' during NTLMSSP on the domain join). Andrew Bartlett (This used to be commit 4c7163e7c2cc09bd95faa05156ee480957a7a4d8)
2002-11-20merged the %U changes to 3.0Andrew Tridgell1-5/+24
(This used to be commit 58fa6bfee8ba35cc182c18c980e0a4040ddd7d09)
2002-11-12Removed global_myworkgroup, global_myname, global_myscope. Added liberalJeremy Allison1-4/+3
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
2002-09-25sync'ing up for 3.0alpha20 releaseGerald Carter1-2/+20
(This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139)
2002-08-17sync 3.0 branch with headJelmer Vernooij1-9/+44
(This used to be commit 3928578b52cfc949be5e0ef444fce1558d75f290)
2002-07-15updated the 3.0 branch from the head branch - ready for alpha18Andrew Tridgell1-63/+367
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-17A nice *big* change to the fundemental way we do things.Andrew Bartlett1-1/+0
Samba (ab)uses the returns from getpwnam() a lot - in particular it keeps them around for a long time - often past the next call... This adds a getpwnam_alloc and a getpwuid_alloc to the collection. These function as expected, returning a malloced structure that can be free()ed with passwd_free(&passwd). This patch also cuts down on the number of calls to getpwnam - mostly by taking advantage of the fact that the passdb interface is already case-insensiteve. With this patch most of the recursive cases have been removed (that I know of) and the problems are reduced further by not using the sys_ interface in the new code. This means that pointers to the cache won't be affected. (This is a tempoary HACK, I intend to kill the password cache entirly). The only change I'm a little worried about is the change to rpc_server/srv_samr_nt.c for private groups. In this case we are getting groups from the new group mapping DB. Do we still need to check for private groups? I've toned down the check to a case sensitve match with the new code, but we might be able to kill it entirly. I've also added a make_modifyable_passwd() function, that copies a passwd struct into the form that the old sys_getpw* code provided. As far as I can tell this is only actually used in the pass_check.c crazies, where I moved the final 'special case' for shadow passwords (out of _Get_Pwnam()). The matching case for getpwent() is dealt with already, in lib/util_getent.c Also included in here is a small change to register the [homes] share at vuid creation rather than just in one varient of the session setup. (This picks up the SPNEGO cases). The home directory is now stored on the vuid, and I am hoping this might provide a saner way to do %H substitions. TODO: Kill off remaining Get_Pwnam_Modify calls (they are not needed), change the remaining sys_getpwnam() callers to use getpwnam_alloc() and move Get_Pwnam to return an allocated struct. Andrew Bartlett (This used to be commit 1d86c7f94230bc53daebd4d2cd829da6292e05da)
2002-01-16Separate out get_user_home_dir() from get_user_home_service_dir().Jeremy Allison1-5/+1
Jeremy. (This used to be commit c1b97226db63daf64359e79083a4754e7c7f8054)
2002-01-16Merged in %S fixes and XX_NOT_CHANGED fixes from 2.2.Jeremy Allison1-16/+53
Jeremy. (This used to be commit 0fcca6c627a5c9c2219ec9714df5e0bc1a44cc29)
2001-12-31const religionSimo Sorce1-3/+3
(This used to be commit c0904d96170a9166b8cd405b75ce4a9bbc32ad1b)
2001-12-06again an intrusive patch:Jean-François Micouleau1-11/+9
- removed the ugly as hell sam_logon_in_ssb variable, I changed a bit the definition of standard_sub_basic() to cope with that. - removed the smb.conf: 'domain admin group' and 'domain guest group' parameters ! We're not playing anymore with the user's group RIDs ! - in get_domain_user_groups(), if the user's gid is a group, put it first in the group RID list. I just have to write an HOWTO now ;-) J.F. (This used to be commit fef52c4b96c987115fb1818c00c2352c67790e50)
2001-11-30Ensured the %G substitution exactly matches what the man page states.Jeremy Allison1-1/+2
Jeremy. (This used to be commit 518084a70d0b20347411535f1dcf7453981499cf)
2001-10-29This commit is number 3 of 4.Andrew Bartlett1-1/+1
In particular this commit focuses on: Changing the Get_Pwnam code so that it can work in a const-enforced environment. While these changes have been mildly tested, and are pretty small, any assistance in this is appreciated. ---- These changes allow for 'const' in 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 (This used to be commit e7634f81c5116ff4addfb7e495f54b6bb78e8f77)
2001-10-29This commit is number 2 of 4.Andrew Bartlett1-3/+14
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)
2001-10-20removed an unused variableAndrew Tridgell1-1/+0
(This used to be commit 9355f251656d0233395dae6978c58f4e520e069b)
2001-10-18Merge Gerry's %G change from 2.2.2.Jeremy Allison1-7/+8
Jeremy. (This used to be commit d8262286ddb6105a9d3b0730912447ea2401a3fb)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-4/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-07-04strchr and strrchr are macros when compiling with optimisation in gcc, so we ↵Andrew Tridgell1-4/+4
can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)
2001-04-25Fixed %U and %D substitutions. %U is lowercase user name, %D is uppercaseJeremy Allison1-2/+12
domain name. Jeremy. (This used to be commit 5f005952f6d8c281cf91ac0855e83342a2fd7e45)
2001-04-08Got "medieval on our ass" about adding the -1 to slprintf.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 94747b4639ed9b19f7d0fb896e43aa392a84989a)
2001-03-26Patch to make automount lookup fallback to get home directory from getpwnam.Jeremy Allison1-9/+15
From Robert Montjoy <Rob_Montjoy@ECECS.UC.EDU>. Jeremy. (This used to be commit 1fe60064bddf29fd778918d3f1a7026002029bd7)
2001-01-23include/vfs.h:Jeremy Allison1-2/+3
smbd/vfs-wrap.c: smbd/vfs.c: Added fchmod_acl and chmod_acl. lib/substitute.c: smbd/lanman.c: smbd/open.c: smbd/process.c: smbd/reply.c: smbd/service.c: Removed sessetup_user variable. Added current_user_info struct which conatins domain info etc. Added '%D' for client domain parameter. Jeremy. (This used to be commit 2844ec3d511680609d6794b8718001a1bda9e89f)
2000-08-25- fixed the %U macro so that the old (and documented) semantics workAndrew Tridgell1-2/+13
again. This got broken with one of the substitute.c updates a couple of months ago. - also fixed %u to return the username from the current_user structure when called via a method that does not have direct access to the username. I cache the uidtoname() result to prevent thrashing nss. (This used to be commit 2520a0eff9c5decbec79aababe9910db3535890a)
2000-06-09do some standard_sub_advanced() in api_net_sam_logon on lp_logon_xxx().Jean-François Micouleau1-1/+1
and if you have unix realname=yes, you get the gecos name when locking the station. J.F. (This used to be commit b5ad24ae0b15643df5832e2369fb4e43c98a1359)
2000-05-02split the username in the vuser structure into a separateAndrew Tridgell1-2/+2
userdom_struct. As the name implies this also contains a domain (unused at the moment). This will be important shortly, as operation in appliance mode needs the domain to be always carried with the username. (This used to be commit ee8546342d5be90e730372b985710d764564b124)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison1-1/+1
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-04-24Now that fsp's are created on successful file open, the structure memberJeremy Allison1-1/+0
fsp->open is no longer needed (if an fsp pointer is valid, then it's open :-). NB for Luke, this patch also did not apply to TNG. TNG is not yet identical w.r.t file serving with HEAD. This makes it impossible for me to help maintain TNG. Please fix asap. lib/substitute.c: Removed unused variable (pidstr). Jeremy. (This used to be commit 389b700a26e8a308a0dff6fc038c38068aa0119a)