[Samba] Freebsd + Samba + Ldap + Acls - No locking file
Hello.. File server freebsd 6.2-STABLE + samba-3.0.25a + ldap + acls Problem: I've a situation where file locking does not seem to be functioning as expected, in that more than one user can open and write to a file without any notifications being displayed about the file already being opened by another user. I have two Windows XP clients accessing the same shared file, user1 has the file open. User2 then opens the same file, receiving no warnings about the file being open by another user. File is modified by user1 and saved and remains open. File then modified by user2 and saved. File closed and opened by user1 who sees only modifications made by user2. user1 (WinXP) open test2.ods smbstatus: Locked files: Pid UidDenyMode Access R/WOplock SharePath Name Time -- 1475810004 DENY_WRITE 0x2019f RDWR EXCLUSIVE+BATCH /work/samba/bazafirm test2.ods Wed Aug 1 17:50:15 1475810004 DENY_NONE 0x11RDONLY NONE /work/samba/bazafirm . Wed Aug 1 17:49:47 user2 (WinXP) open file: smbstatus: Locked files: Pid UidDenyMode Access R/WOplock SharePath Name Time -- 1478710002 DENY_WRITE 0x2019f RDWR EXCLUSIVE+BATCH /work/samba/bazafirm test2.ods Wed Aug 1 17:55:38 1478710002 DENY_NONE 0x11RDONLY NONE /work/samba/bazafirm . Wed Aug 1 17:55:12 But when I use option force user = root tha file lock works OK!!! smb.conf [global] dos charset = cp852 unix charset = iso8859-2 display charset = iso8859-2 workgroup = COSTAM.LOCAL netbios name = DRAGON server string = COSTAM LDAP PDC [on FreeBSD :: Samba server %v] interfaces = 192.168.50.254/24 bind interfaces only = Yes security = USER encrypt passwords = Yes update encrypted = No client schannel = Auto server schannel = Auto allow trusted domains = Yes map to guest = Never null passwords = Yes obey pam restrictions = No password server = * smb passwd file = /usr/local/etc/samba/smbpasswd private dir = /usr/local/etc/samba passdb backend = ldapsam:ldap://127.0.0.1/ algorithmic rid base = 1000 guest account = nobody enable privileges = Yes pam password change = No passwd chat = *new*password* %n\n *new*password* %n\n *changed* passwd chat debug = No passwd chat timeout = 2 check password script = password level = 0 username level = 0 unix password sync = No restrict anonymous = 0 lanman auth = Yes ntlm auth = Yes client NTLMv2 auth = No client lanman auth = Yes client plaintext auth = Yes use kerberos keytab = No log level = 2 syslog = 0 syslog only = No log file = /var/log/samba/log.%m max log size = 10 debug timestamp = Yes debug prefix timestamp = No debug hires timestamp = No debug pid = No debug uid = No enable core files = Yes smb ports = 445 139 large readwrite = Yes max protocol = NT1 min protocol = CORE read bmpx = No read raw = Yes write raw = Yes disable netbios = No reset on zero vc = No acl compatibility = auto defer sharing violations = Yes nt pipe support = Yes nt status support = Yes announce version = 4.9 announce as = NT max mux = 50 max xmit = 16644 name resolve order = wins bcast dns host max ttl = 259200 max wins ttl = 518400 min wins ttl = 21600 time server = Yes unix extensions = Yes use spnego = Yes client signing = auto server signing = No client use spnego = Yes enable asu support = No deadtime = 0 getwd cache = Yes keepalive = 300 lpq cache time = 30 max smbd processes = 0 paranoid server security = Yes max disk size = 0 max open files = 500 open files database hash size = 10007 socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY SO_SNDBUF=16384 SO_RCVBUF=16384 IPTOS_LOWDELAY use mmap = Yes hostname lookups = No name cache timeout = 660 load printers = No printcap cache time = 750 disable spoolss = No show add printer wizard = Yes mangling method = hash2 mangle prefix = 1 max stat cache size = 1024 stat cache = Yes machine password timeout = 604800 add user script = /usr/local/sbin/smbldap-useradd -m %u delete user script = /usr/local/sbin/smbldap-userdel %u add group script = /usr/local/sbin/smbldap-groupadd -p %g delete group script = /usr/local/sbin/smbldap-groupdel %g add user to group script = /usr/local/sbin/smbldap-groupmod -m %u %g delete user from group script = /usr/local/sbin/smbldap-groupmod -x %u %g set primary group script = /usr/local/sbin/smbldap-usermod -g %g %u add machine script = /usr/local/sbin/smbldap-useradd -w %u
[Samba] Re: oplock not working correctly
Hello.. I've the same problem... dou you get solution? Iain: I posted a problem with oplock previously, but am guessing it goto lost in an earlier thread with the same subject line, so here goes another shot: Using Samba 3.0.22 on a Gentoo box (kernel 2.6.15) I've a situation where file locking does not seem to be functioning as expected, in that more than one user can open and write to a file without any notifications being displayed about the file already being opened by another user. In the debug output below I have two Windows XP clients accessing the same shared file, neteng02 has the file open. neteng-vm3 then opens the same file, receiving no warnings about the file being open by another user. File is modified by neteng02 and saved and remains open. File then modified by neteng-vm3 and saved. File closed and opened by neteng02 who sees only modifications made by neteng-vm3. *** START *** log.neteng-vm3:[2006/04/26 11:33:57, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(166) log.neteng-vm3: linux_set_kernel_oplock: got kernel oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 225 log.neteng-vm3:[2006/04/26 11:33:57, 5] smbd/oplock.c:set_file_oplock(125) log.neteng-vm3: set_file_oplock: granted oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 225,tv_sec = 444f3e85, tv_usec = 88676 log.neteng-vm3:[2006/04/26 11:33:57, 3] smbd/oplock.c:initial_break_processing(311) log.neteng-vm3: Current oplocks_open (exclusive = 0, levelII = 1) log.neteng02:[2006/04/26 11:33:57, 3] smbd/oplock.c:initial_break_processing(311) log.neteng02: Current oplocks_open (exclusive = 1, levelII = 0) log.neteng02:[2006/04/26 11:33:53, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(166) log.neteng02: linux_set_kernel_oplock: got kernel oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 458 log.neteng02:[2006/04/26 11:33:53, 5] smbd/oplock.c:set_file_oplock(125) log.neteng02: set_file_oplock: granted oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 458,tv_sec = 444f3e81, tv_usec = d7ef7 *** END *** My smb/conf file looks like: *** START *** [global] netbios name = NETMON2 workgroup = MYCORP server string = LDAP PDC hosts allow = 172.16.0.0/19 security = user encrypt passwords = yes socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 interfaces = lo eth0 bind interfaces only = yes local master = yes os level = 65 domain master = yes domain logons = yes preferred master = yes null passwords = no hide unreadable = yes hide dot files = yes logon script = %U.bat logon drive = H: logon home = \\%L\%U wins support = yes name resolve order = wins lmhosts host bcast dns proxy = yes time server = yes log file = /var/log/samba/log.%m max log size = 50 log level = 5 add user script = /usr/sbin/smbldap-useradd -m %u add machine script = /usr/sbin/smbldap-useradd -w %u add group script = /usr/sbin/smbldap-groupadd -p %g add user to group script = /usr/sbin/smbldap-groupmod -m %u %g delete user from group script = /usr/sbin/smbldap-groupmod -x %u %g set primary group script = /usr/sbin/smbldap-usermod -g %g %u passdb backend = ldapsam:ldap://127.0.0.1/ ldap delete dn = Yes ldap ssl = no ldap suffix = dc=waldocorp,dc=com ldap admin dn = cn=Manager,dc=waldocorp,dc=com ldap group suffix = ou=Groups ldap user suffix = ou=Users ldap machine suffix = ou=Computers ldap idmap suffix = ou=Users printcap name = cups load printers = yes printing = cups admin users = @Domain Admins kernel oplocks = yes oplocks = yes level2 oplocks = yes strict locking = yes [printers] comment = All Printers path = /var/spool/samba browseable = yes guest ok = yes writable = no printable = yes create mode = 0700 default devmode = yes [print$] comment = Printer Driver Download Area path = /home/samba/printers browseable = yes read only = yes write list = @Domain Admins guest ok = yes [netlogon] path = /home/samba/netlogon guest ok = yes browseable = no write list = root [profiles] path = /home/samba/profiles writeable = yes browseable = no read only = no create mode = 0644 directory mode = 0755 guest ok = yes [homes] path = /home/samba/users/%U browseable = no valid users = %S read only = no create mask = 0664 directory mask = 0775 [software] comment = Software Repository path = /home/samba/software guest ok = no public = yes read only = no browseable = yes force create mode = 0775 force directory mode = 6775 [engineering] comment = Network Engineering Group Share path = /home/samba/groups/engineering guest ok = no public = yes read only = no browseable = yes force create mode = 0775 force directory mode = 6775 [finance] comment = Finance Group Share path = /home/samba/groups/finance guest ok = no public = yes read only = no
Re: [Samba] AD + winbindd(8): group permissions being ignored ? WTF ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wilkinson, Alex wrote: Hi all, I am successfully authenticating FreeBSD 7.0-CURRENT #1: Wed Jul 25 17:31:15 WST 2007 against AD. Users can log in succesfully with home directories being served via amd(8) and NFS. However, I have discovered a potential show-stopper that will force me to abort this mission :( The problem -~-~-~-~-~- In a nutshell: Simple group permissions set with chown(1) are not being honoured. e.g. #touch testing.txt #ls -l !$ -rw-r--r-- 1 root wheel 0 Aug 12 17:49 testing #chmod 770 !$ #ls -l testing.txt -rwxrwx--- 1 root wheel 0 Aug 12 17:49 testing.txt #chown root:scis stl admins testing.txt #ls -l !$ ls -l testing.txt -rwxrwx--- 1 root scis stl admins 0 Aug 12 17:49 testing.txt #su - my_username my__shellecho this sux /var/tmp/testing.txt testing.txt: Permission denied. And I KNOW 150% I am in the the group scis stl admins. The odd thing is, is that chown(1) allows me to give the file testing.txt group memebership, but users in the actual group are not given these permissions. I'm getting kinda desparate now. Have I missed something concetually ? Any insights into this problem whatsoever will be greatly appreciated. Have a look and see if this report is relevant in your case (it's fairly long): https://bugzilla.samba.org/show_bug.cgi?id=3990 Regards, Doug -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGwBnjFqWysr/jOHMRAsOjAKCOmNUxd1qX8gkomfS+D4f0FbFjmACgraNH q0AlGUfH8cGw0opxo2L8BmI= =D1B1 -END PGP SIGNATURE- -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] password server DOMDC1 rejected the password: NT_STATUS_LOGON_FAILURE
Hello list, I have trouble with a smb configuration that worked fine before I upgraded my samba to the latest stable release. I used samba 3.0.23c (Slackware11) and now I'm using samba 3.0.25b (Slackware12). The error/failure looks like this: I'm trying to connect to my HOME service and I fail. The log produces only this: [2007/08/13 10:29:33, 1] auth/auth_server.c:check_smbserver_security(357) password server DOMDC1 rejected the password: NT_STATUS_LOGON_FAILURE What is wrong now after the upgrade? I swear the config file worked OK before! here the results of testparm: Load smb config files from /etc/samba/smb.conf Processing section [homes] Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions [global] workgroup = DOM server string = D-GA Linux MICA Samba %v security = SERVER password server = domdc1 domdc2 username map = /etc/samba/private/users.map lanman auth = No max log size = 50 load printers = No os level = 10 preferred master = No local master = No domain master = No dns proxy = No wins server = 172.27.135.10, 172.27.135.11 [homes] comment = Home Directories read only = No browseable = No The results of the logfile: [2007/08/13 10:36:07, 0] smbd/server.c:main(944) smbd version 3.0.25b started. Copyright Andrew Tridgell and the Samba Team 1992-2007 [2007/08/13 10:45:11, 1] auth/auth_server.c:check_smbserver_security(357) password server DOMDC1 rejected the password: NT_STATUS_LOGON_FAILURE Thanks for your help! Cheers, Michael -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
Re: [Samba] Trailing backslash issue with Windows Shares
Hi there, I have Samba 3.0.25b running as a PDC. When opening a share on a Windows member server from an XP/Vista client, if I add a trailing backslash after a share name (e.g. \\WIN-SERVER\C$\) then an explorer windows appears immediately and correctly contains the share. Without the backslash (e.g. \\WIN-SERVER\C$) I have observed delays of up to 20 seconds. I have msdfs root = yes in my smb.conf. Is this a known problem ? Yeah, known bug someone reported - will be fixed for 3.0.25c. Whilst looking at other things, we've seen Wireshark traces where the client appears to ask for:- \\server\shar before actually asking for \\server\share Could this be the same issue ? Mac Assistant Systems Administrator @nibsc.ac.uk [EMAIL PROTECTED] Work: +44 1707 641565 Everything else: +44 7956 237670 (anytime) -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
Re: [Samba] ppolicy overlay (WAS: Enforcing Password Policies...)
On Monday 13 August 2007 03:11, Andrew Bartlett wrote: On Thu, 2007-08-09 at 00:56 +0200, Thierry Lacoste wrote: On Wednesday 08 August 2007 20:17, Matt Anderson wrote: Dear Help, I'm currently running Samba with an LDAP passdb backend. I'm trying to figure out how to NOT allow a particular user to change their password (through Windows, or any interface). I've tried modifying the values for sambaPwdCanChange and sambaPwdMustChange for a particular user, but it seems like it only effects making them change their password, instead of whether or not they're ALLOWED to. With OpenLDAP one can use ldap passwd sync = only in smb.conf and let the smbk5pwd overlay synchronize the LM and NT passwords. If you add the ppolicy overlay you have a clean way to prevent password changes for some acounts (through Windows, or any interface). For instance one can use a pwdPolicy with pwdAllowUserChange: FALSE The only problem is that a Windows client reports a successful password change even though the password was not changed because of the above pwdPolicy. Was it not changed? To OpenLDAP, the change from Samba doesn't look like a user change (because we set it using Samba's credentials). According to man 5 slapo-ppolicy: Note that some of the policies do not take effect when the operation is performed with the rootdn identity; all the operations, when performed with any other identity, may be subjected to constraints, like access control. The pwdPolicy applies to my smb.conf ldap admin dn because it is not my slapd.conf rootdn. - I first remove the pwdPolicy from a user's account using my rootdn: $ ldapmodify -D 'cn=ldapmgr,ou=managers,o=stars' -w ldappass dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify delete: pwdPolicySubentry modifying entry uid=lacoste,ou=Users,ou=Accounts,o=stars - I confirm that my slapd.conf ACLs allow my ldap admin dn to change a user's password: $ ldapmodify -D 'cn=sambamgr,ou=managers,o=stars' -w sambapass dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify userPassword: secret1 modifying entry uid=lacoste,ou=Users,ou=Accounts,o=stars - I apply a pwdPolicy: $ ldapsearch -LLL -b 'ou=Policies,o=stars' 'cn=frozen' dn: cn=frozen,ou=Policies,o=stars objectClass: pwdPolicy objectClass: device objectClass: top cn: frozen pwdAttribute: userPassword pwdAllowUserChange: FALSE $ ldapmodify -D 'cn=ldapmgr,ou=managers,o=stars' -w ldappass dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify add: pwdPolicySubentry pwdPolicySubentry: cn=frozen,ou=Policies,o=stars modifying entry uid=lacoste,ou=Users,ou=Accounts,o=stars - Now my ldap admin dn cannot change the user's password: $ ldapmodify -D 'cn=sambamgr,ou=managers,o=stars' -w sambapass dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify userPassword: secret2 modifying entry uid=lacoste,ou=Users,ou=Accounts,o=stars ldap_modify: Insufficient access (50) additional info: User alteration of password is not allowed Regards, Thierry. -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] ldap passwd sync on 3.0.25a
I have an strange issue with ldap passwd sync = only on FreeBSD 6.1 with Samba 3.0.25a + OpenLDAP 2.3.37 I have the OpenLDAP smbk5pwd overlay which successfuly synchronizes LM and NT passwords: $ ldappasswd -D 'cn=sambamgr,ou=managers,o=stars' -w sambapass -s secret1 'uid=lacoste,ou=Users,ou=Accounts,o=stars' Result: Success (0) My OpenLDAP auditlog file confirms that smbk5pwd is working: # modify 1187006837 o=stars cn=sambamgr,ou=Managers,o=stars dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify replace: userPassword userPassword:: e1NTSEF9UFZSZk1zcTNoRlFuYWhGMzRWN1BZWE5BU3U0MHNVTWo= - replace: sambaPwdMustChange sambaPwdMustChange: 1218542837 - replace: sambaPwdLastSet sambaPwdLastSet: 1187006837 - replace: sambaLMPassword sambaLMPassword: 8d16f4badd1da493aad3b435b51404ee - replace: sambaNTPassword sambaNTPassword: b39a61f16a4e11fa80580241f1d4aae8 - replace: pwdChangedTime pwdChangedTime: 20070813120717Z - replace: entryCSN entryCSN: 20070813120717Z#00#00#00 - replace: modifiersName modifiersName: cn=sambamgr,ou=Managers,o=stars - replace: modifyTimestamp modifyTimestamp: 20070813120717Z - # end replace 1187006837 Here's the auditlog when I modify the password under Windows XP with ldap passwd sync = yes. Note that as expected there are two modifications: - one for the LM and NT passwords - and one for the userPassword which triggers another change of the LM and NT passwords. # modify 1187007048 o=stars cn=sambamgr,ou=Managers,o=stars dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify delete: sambaLMPassword sambaLMPassword: 8d16f4badd1da493aad3b435b51404ee - add: sambaLMPassword sambaLMPassword: 485B60ABDAF3DCBEAAD3B435B51404EE - delete: sambaNTPassword sambaNTPassword: b39a61f16a4e11fa80580241f1d4aae8 - add: sambaNTPassword sambaNTPassword: C2CC78BA8B1DF908F563858B3095C7C7 - delete: sambaPwdLastSet sambaPwdLastSet: 1187006837 - add: sambaPwdLastSet sambaPwdLastSet: 1187007048 - replace: entryCSN entryCSN: 20070813121048Z#00#00#00 - replace: modifiersName modifiersName: cn=sambamgr,ou=Managers,o=stars - replace: modifyTimestamp modifyTimestamp: 20070813121048Z - # end replace 1187007048 # modify 1187007048 o=stars cn=sambamgr,ou=Managers,o=stars dn: uid=lacoste,ou=Users,ou=Accounts,o=stars changetype: modify replace: userPassword userPassword:: e1NTSEF9YmVKTHNIOFVaK3pkNDJ4WGhHTUdtcVk2QjZiMWVzR1Q= - replace: sambaPwdMustChange sambaPwdMustChange: 1218543048 - replace: sambaPwdLastSet sambaPwdLastSet: 1187007048 - replace: sambaLMPassword sambaLMPassword: 485b60abdaf3dcbeaad3b435b51404ee - replace: sambaNTPassword sambaNTPassword: c2cc78ba8b1df908f563858b3095c7c7 - replace: pwdChangedTime pwdChangedTime: 20070813121048Z - replace: entryCSN entryCSN: 20070813121048Z#01#00#00 - replace: modifiersName modifiersName: cn=sambamgr,ou=Managers,o=stars - replace: modifyTimestamp modifyTimestamp: 20070813121048Z - # end replace 1187007048 To avoid the double change of LM and NT passwords I set ldap passwd sync = only in my smb.conf but when I change the password from XP none of the passwords is changed even though XP reports success. This works like a charm with Samba 3.0.22 + OpenLDAP 2.3.24 under FreeBSD 6.1. Any help to troubleshoot the problem would be appreciated. Regards, Thierry. -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
Re: [Samba] AD + winbindd(8): group permissions being ignored ? WTF ?
0n Mon, Aug 13, 2007 at 01:44:19AM -0700, Doug VanLeuven wrote: Have a look and see if this report is relevant in your case (it's fairly long): https://bugzilla.samba.org/show_bug.cgi?id=3990 This is my *exact* problem. I am using version 3.0.25a,1.1. And looking at work/samba-3.0.25a/source/smbd/sec_ctx.c it looks like Björn Jacke's patch has not been included. So I proceed to apply the patch myself and run into: # patch -p0 group_fix_patch.txt Hmm... Looks like a unified diff to me... The text leading up to this was: -- |Index: source/smbd/sec_ctx.c |=== |--- source/smbd/sec_ctx.c (Revision 23033) |+++ source/smbd/sec_ctx.c (Arbeitskopie) -- Patching file source/smbd/sec_ctx.c using Plan A... Hunk #1 succeeded at 248 (offset 2 lines). done # #cd /usr/ports/net/samba3/ #make install === Patching for samba-3.0.25a_1,1 === Applying FreeBSD patches for samba-3.0.25a_1,1 1 out of 5 hunks failed--saving rejects to smbd/sec_ctx.c.rej = Patch patch-smbd_sec_ctx.c failed to apply cleanly. = Patch(es) patch-Makefile.in patch-client_client.c patch-configure.in patch-include_includes.h patch-lib_ico nv.c patch-lib_replace_libreplace_cc.m4 patch-nsswitch_pam_winbind.c patch-nsswitch_winbindd.c patch-pam_smbpa ss_pam_smb_auth.c patch-pam_smbpass_pam_smb_passwd.c patch-pam_smbpass_support.c patch-script_installbin.sh.in patch-script_installswat.sh patch-smbd_aio.c applied cleanly. *** Error code 1 I *really* need this patch so that I can manage shared data via AD groups. Can anyone lend a helping hand in making samba compile in FreeBSD ports with the following patch [http://marc.info/?l=samba-technicalm=117976475614078w=2] ? Or can the FreeBSD net/samba3 port maintainer get this patch included into the port ASAP ? Thanks -aW IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] small patch
Dear listmembers, this patch improves behaviour of samba-3.0.25b with regard to finding the right config.h. --- source/lib/replace/replace.h.original 2007-04-21 03:48:08.0 +0200 +++ source/lib/replace/replace.h2007-08-13 13:17:43.0 +0200 @@ -29,7 +29,7 @@ #define _LIBREPLACE_REPLACE_H #ifndef NO_CONFIG_H -#include config.h +#include include/config.h #endif #ifdef HAVE_STANDARDS_H The attachement contains exactly this patch. Take care Dieter Jurzitza -- HARMAN BECKER AUTOMOTIVE SYSTEMS Dr.-Ing. Dieter Jurzitza Manager Hardware Systems System Development Industriegebiet Ittersbach Becker-Göring Str. 16 D-76307 Karlsbad / Germany Phone: +49 (0)7248 71-1577 Mobile: +49 0151 - 16 339 017 Fax:+49 (0)7248 71-1216 eMail: [EMAIL PROTECTED] Internet: http://www.becker.de *** Harman Becker Automotive Systems GmbH Geschaeftsfuehrung: Dr. Peter Geiselhart - Michael Mauser - William S. Palin - Edwin Summers - Regis Baudot Sitz der Gesellschaft: Karlsbad - Registergericht: Mannheim HRB 361395 *** Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the contents in this e-mail is strictly forbidden. *** -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
Re: [Samba] OK. there I am again!
For most of these answers the following links have a lot of information: http://samba.org/samba/docs/man/Samba-HOWTO-Collection/NetworkBrowsing.html#id349177 http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.fastconnect/doc/fastcon/winnetcon.htm http://www.samba.org/cifs/docs/what-is-smb.html http://us3.samba.org/samba/docs/man/Samba-Guide/primer.html#id386486 Third: I read quite a lot about how to set up various servers, but not too many details on exactly what the SMB protocols do. I read something about elections, and I think that part is fairly clear to me, but I am quite curious about what several parties in the game are really doing. For instance, when a server comes up, how does the rest of the world know? There are two ways that I know NetBIOS and WINS. The first way (NetBIOS) is that the client broadcasts its name and ip address to the broadcast address on the network subnet. The master browser on that subnet listens for these broadcasts and creates a list of the machines and then it replies to the client its ip adress and a second and smaller list of the machines who contain the browse lists. So when a client wants the browse list it will contact the master browser if it can or one of the other backup browsers if the master does not answer. I commented out the remote announce line, so I guess that is not part of the mechanism. This is only for networks with more than one subnet. Anyway, if the server is initially the only node in the network, this will not be significant anyway. If a client comes up, what happens? Does it broadcast its presence throughout the network? Yes. Do all servers respond? No. Only the master browser. I also read something about browser nodes, but how are they established? These other machines that are not the master browser that also hold a copy of the browse list. Elections rule which machines will be involved. How do they announce their presence? Send a packet to the broadcast address. In general: is there any detail documentation on MS SMB protocols, not just the message format but rather the exact mechanisms? They may be described somewhere, but I haven't discovered them yet... There is a lot of info scattered around the internet on this but for a very well written single guide that has all the info you are looking for I am not sure. I have more questions, but these are the most pressing ones at the moment. Thanks a lot in advance for any clues. -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba -- John M. Drescher -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] UID and GID mappings
With a smb.conf like the following where does samba store the UID to GID mappings? Is there a way to view this? Also can't I use a method that converts SIDs to UIDs and GIDs on a consistent basis? Thanks Mark #=== Global Settings = [global] workgroup = XXX server string = Samba Server security = ads encrypt passwords = yes realm = XXX.XXX.EDU winbind separator = + idmap uid = 1-2 idmap gid = 1-2 template shell = /bin/bash homedir = /export/home/%U log level = 5 socket options = TCP_NODELAY # Share Definitions == #[homes] # comment = Home Directories # browseable = no # writable = yes # A publicly accessible directory, but read only, except for people in # the staff group [public] comment = Public Stuff path = /home/samba public = yes writable = yes printable = no write list = @XXX+samba -- Mark Campbell Systems Analyst Digital Library Technologies The Pennsylvania State University [EMAIL PROTECTED], 814-865-4774 -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
Re: [Samba] Re: oplock not working correctly
On 8/13/07, vwdragon [EMAIL PROTECTED] wrote: Hello.. I've the same problem... dou you get solution? Iain: I posted a problem with oplock previously, but am guessing it goto lost in an earlier thread with the same subject line, so here goes another shot: Using Samba 3.0.22 on a Gentoo box (kernel 2.6.15) I've a situation where file locking does not seem to be functioning as expected, in that more than one user can open and write to a file without any notifications being displayed about the file already being opened by another user. In the debug output below I have two Windows XP clients accessing the same shared file, neteng02 has the file open. neteng-vm3 then opens the same file, receiving no warnings about the file being open by another user. File is modified by neteng02 and saved and remains open. File then modified by neteng-vm3 and saved. File closed and opened by neteng02 who sees only modifications made by neteng-vm3. Are these files MS office files? I ask that because of the way MS opens files that it never writes to the file that it opens. It instead creates a new file and writes to the new then deletes the old and renames the new to the old. Although having said that I am not sure how Office tells a file is in use... John -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] Re: oplock not working correctly
Are these files MS office files? I ask that because of the way MS opens files that it never writes to the file that it opens. It instead creates a new file and writes to the new then deletes the old and renames the new to the old. Although having said that I am not sure how Office tells a file is in use... John These files are OpenOffice... When I use opiton force user = root in smb.conf then it's work ok.. Oplock working... But everyone working as root :( -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] Compile error
When I t ry to compile the lastest release of samba i get the following error: Undefined first referenced symbol in file error_message libsmb/cliconnect.o (symbol belongs to implicit dependency /usr/local/krb5/lib/libcom_err.so.3) ld: fatal: Symbol referencing errors. No output written to bin/smbd collect2: ld returned 1 exit status *** Error code 1 The following command caused the error: Any ideas? Thanks Mark -- Mark Campbell Systems Analyst Digital Library Technologies The Pennsylvania State University [EMAIL PROTECTED], 814-865-4774 -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
[Samba] Samba and Windows Domain Usernames
Hi to all on the samba lista. I'm new on Samba and on the mailing list so forgive me for any misunderstading that I may commit. I have a Samba daemon running on a OpenBSD machine with only a directory shared. Anyone can read and write on that directory. However, on the same local network there are various Windows machines and the users of those machines are users of a Windows Domain. Is it possible (and if yes, how) to define on smb.conf that certain usernames can read/write some shares, others can only read other shares, and Windows prompts for the combination username/password for other shares? Those users that logon on the Windows machine should'nt be prompt again for a password on the samba share (if in fact they have permission to access that share). I have read the Samba users manual and some examples but didn't find anything about this. I hope that you can help me, and my sincere regards, Marco Ferra -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
svn commit: samba r24355 - in branches/SAMBA_3_2/source/smbd: .
Author: metze Date: 2007-08-13 07:20:19 + (Mon, 13 Aug 2007) New Revision: 24355 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24355 Log: move reply_outbuf() to the place where it's used metze Modified: branches/SAMBA_3_2/source/smbd/reply.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/reply.c === --- branches/SAMBA_3_2/source/smbd/reply.c 2007-08-12 21:23:06 UTC (rev 24354) +++ branches/SAMBA_3_2/source/smbd/reply.c 2007-08-13 07:20:19 UTC (rev 24355) @@ -3435,7 +3435,6 @@ } nwritten = write_file(fsp,data,startpos,numtowrite); - reply_outbuf(req, 6, 0); } if(((nwritten == 0) (numtowrite != 0))||(nwritten 0)) { @@ -3444,6 +3443,7 @@ return; } + reply_outbuf(req, 6, 0); SSVAL(req-outbuf,smb_vwv2,nwritten); if (large_writeX) SSVAL(req-outbuf,smb_vwv4,(nwritten16)1);
svn commit: samba r24356 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 08:33:01 + (Mon, 13 Aug 2007) New Revision: 24356 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24356 Log: Add send_nt_replies_new wrapper Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 07:20:19 UTC (rev 24355) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 08:33:01 UTC (rev 24356) @@ -262,6 +262,24 @@ return 0; } +void send_nt_replies_new(struct smb_request *req, NTSTATUS nt_error, +char *params, int paramsize, + char *pdata, int datasize) +{ + char *inbuf, *outbuf; + int length, bufsize; + + if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + return; + } + + reply_post_legacy( + req, + send_nt_replies(inbuf, outbuf, bufsize, nt_error, + params, paramsize, pdata, datasize)); +} + / Is it an NTFS stream name ? /
svn commit: samba r24357 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 08:50:09 + (Mon, 13 Aug 2007) New Revision: 24357 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24357 Log: Check wct in reply_nttrans[s] Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 08:33:01 UTC (rev 24356) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 08:50:09 UTC (rev 24357) @@ -3176,17 +3176,27 @@ char *inbuf,char *outbuf,int size,int bufsize) { int outsize = 0; - uint32 pscnt = IVAL(inbuf,smb_nt_ParameterCount); - uint32 psoff = IVAL(inbuf,smb_nt_ParameterOffset); - uint32 dscnt = IVAL(inbuf,smb_nt_DataCount); - uint32 dsoff = IVAL(inbuf,smb_nt_DataOffset); - - uint16 function_code = SVAL( inbuf, smb_nt_Function); + uint32 pscnt; + uint32 psoff; + uint32 dscnt; + uint32 dsoff; + uint16 function_code; NTSTATUS result; struct trans_state *state; START_PROFILE(SMBnttrans); + if (CVAL(inbuf, smb_wct) 19) { + END_PROFILE(SMBnttrans); + return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + } + + pscnt = IVAL(inbuf,smb_nt_ParameterCount); + psoff = IVAL(inbuf,smb_nt_ParameterOffset); + dscnt = IVAL(inbuf,smb_nt_DataCount); + dsoff = IVAL(inbuf,smb_nt_DataOffset); + function_code = SVAL( inbuf, smb_nt_Function); + if (IS_IPC(conn) (function_code != NT_TRANSACT_CREATE)) { END_PROFILE(SMBnttrans); return ERROR_DOS(ERRSRV,ERRaccess); @@ -3353,6 +3363,11 @@ show_msg(inbuf); + if (CVAL(inbuf, smb_wct) 18) { + END_PROFILE(SMBnttranss); + return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + } + for (state = conn-pending_trans; state != NULL; state = state-next) { if (state-mid == SVAL(inbuf,smb_mid)) {
svn commit: samba-docs r1147 - in trunk/manpages-3: .
Author: kseeger Date: 2007-08-13 09:02:42 + (Mon, 13 Aug 2007) New Revision: 1147 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-docsrev=1147 Log: Fix typos found by Bjoern Jacke [EMAIL PROTECTED] Karolin Modified: trunk/manpages-3/pam_winbind.7.xml Changeset: Modified: trunk/manpages-3/pam_winbind.7.xml === --- trunk/manpages-3/pam_winbind.7.xml 2007-08-12 22:57:04 UTC (rev 1146) +++ trunk/manpages-3/pam_winbind.7.xml 2007-08-13 09:02:42 UTC (rev 1147) @@ -52,7 +52,7 @@ termrequire_membership_of=[SID or NAME]/term listitempara If this option is set, pam_winbind will only succeed if the user is a member of the given SID or NAME. A SID - can be either a group-SID, a alias-SID or even a user-SID. It is also possible to give a NAME instead of the + can be either a group-SID, an alias-SID or even an user-SID. It is also possible to give a NAME instead of the SID. That name must have the form: parameterMYDOMAIN\\mygroup/parameter or parameterMYDOMAIN\\myuser/parameter. pam_winbind will, in that case, lookup the SID internally. Note that NAME may not contain any spaces. It is thus recommended to only use SIDs. You can verify the list of SIDs a
svn commit: samba r24358 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 09:12:21 + (Mon, 13 Aug 2007) New Revision: 24358 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24358 Log: Push reply_prep_legacy into reply_nttrans[s] Modified: branches/SAMBA_3_2/source/smbd/nttrans.c branches/SAMBA_3_2/source/smbd/process.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 08:50:09 UTC (rev 24357) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 09:12:21 UTC (rev 24358) @@ -3172,8 +3172,7 @@ Reply to a SMBNTtrans. / -int reply_nttrans(connection_struct *conn, - char *inbuf,char *outbuf,int size,int bufsize) +void reply_nttrans(connection_struct *conn, struct smb_request *req) { int outsize = 0; uint32 pscnt; @@ -3184,11 +3183,21 @@ NTSTATUS result; struct trans_state *state; + char *inbuf, *outbuf; + int size, bufsize; + START_PROFILE(SMBnttrans); + if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBnttrans); + return; + } + if (CVAL(inbuf, smb_wct) 19) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); END_PROFILE(SMBnttrans); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + return; } pscnt = IVAL(inbuf,smb_nt_ParameterCount); @@ -3198,20 +3207,23 @@ function_code = SVAL( inbuf, smb_nt_Function); if (IS_IPC(conn) (function_code != NT_TRANSACT_CREATE)) { + reply_doserror(req, ERRSRV, ERRaccess); END_PROFILE(SMBnttrans); - return ERROR_DOS(ERRSRV,ERRaccess); + return; } result = allow_new_trans(conn-pending_trans, SVAL(inbuf, smb_mid)); if (!NT_STATUS_IS_OK(result)) { DEBUG(2, (Got invalid nttrans request: %s\n, nt_errstr(result))); + reply_nterror(req, result); END_PROFILE(SMBnttrans); - return ERROR_NT(result); + return; } if ((state = TALLOC_P(conn-mem_ctx, struct trans_state)) == NULL) { + reply_doserror(req, ERRSRV, ERRaccess); END_PROFILE(SMBnttrans); - return ERROR_DOS(ERRSRV,ERRaccess); + return; } state-cmd = SMBnttrans; @@ -3244,8 +3256,9 @@ /* Don't allow more than 128mb for each value. */ if ((state-total_data (1024*1024*128)) || (state-total_param (1024*1024*128))) { + reply_doserror(req, ERRDOS, ERRnomem); END_PROFILE(SMBnttrans); - return ERROR_DOS(ERRDOS,ERRnomem); + return; } if ((dscnt state-total_data) || (pscnt state-total_param)) @@ -3258,8 +3271,9 @@ DEBUG(0,(reply_nttrans: data malloc fail for %u bytes !\n, (unsigned int)state-total_data)); TALLOC_FREE(state); + reply_doserror(req, ERRDOS, ERRnomem); END_PROFILE(SMBnttrans); - return(ERROR_DOS(ERRDOS,ERRnomem)); + return; } if ((dsoff+dscnt dsoff) || (dsoff+dscnt dscnt)) goto bad_param; @@ -3278,8 +3292,9 @@ bytes !\n, (unsigned int)state-total_param)); SAFE_FREE(state-data); TALLOC_FREE(state); + reply_doserror(req, ERRDOS, ERRnomem); END_PROFILE(SMBnttrans); - return(ERROR_DOS(ERRDOS,ERRnomem)); + return; } if ((psoff+pscnt psoff) || (psoff+pscnt pscnt)) goto bad_param; @@ -3302,8 +3317,9 @@ SAFE_FREE(state-data); SAFE_FREE(state-param); TALLOC_FREE(state); + reply_doserror(req, ERRDOS, ERRnomem); END_PROFILE(SMBnttrans); - return ERROR_DOS(ERRDOS,ERRnomem); + return; } if ((smb_nt_SetupStart + state-setup_count smb_nt_SetupStart) || @@ -3325,8 +3341,9 @@ SAFE_FREE(state-param); SAFE_FREE(state-data); TALLOC_FREE(state); + reply_post_legacy(req, outsize); END_PROFILE(SMBnttrans); - return outsize; + return; } DLIST_ADD(conn-pending_trans, state); @@ -3336,7 +3353,8 @@
svn commit: samba r24359 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 09:49:03 + (Mon, 13 Aug 2007) New Revision: 24359 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24359 Log: Fix the build Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 09:12:21 UTC (rev 24358) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 09:49:03 UTC (rev 24359) @@ -3384,7 +3384,7 @@ if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBnttrans); + END_PROFILE(SMBnttranss); return; }
svn commit: samba-docs r1148 - in trunk/Samba3-HOWTO: .
Author: jht Date: 2007-08-13 13:14:52 + (Mon, 13 Aug 2007) New Revision: 1148 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-docsrev=1148 Log: Removal of mulitple passdb backend notes. Modified: trunk/Samba3-HOWTO/TOSHARG-Passdb.xml Changeset: Modified: trunk/Samba3-HOWTO/TOSHARG-Passdb.xml === --- trunk/Samba3-HOWTO/TOSHARG-Passdb.xml 2007-08-13 09:02:42 UTC (rev 1147) +++ trunk/Samba3-HOWTO/TOSHARG-Passdb.xml 2007-08-13 13:14:52 UTC (rev 1148) @@ -14,7 +14,7 @@ addressemail[EMAIL PROTECTED]/email/address /affiliation /author - + pubdateMay 24, 2003/pubdate /chapterinfo titleAccount Information Databases/title @@ -24,10 +24,9 @@ indextermprimarypassword backends/primary/indexterm indextermprimaryscalability/primary/indexterm indextermprimaryADS/primary/indexterm -Samba-3 implements a new capability to work concurrently with multiple account backends. -The possible new combinations of password backends allows Samba-3 a degree of flexibility -and scalability that previously could be achieved only with MS Windows Active Directory (ADS). -This chapter describes the new functionality and how to get the most out of it. +Early releases of Samba-3 implemented new capability to work concurrently with multiple account backends. This +capability was removed beginning with release of Samba 3.0.23. Commencing with Samba 3.0.23 it is possible to +work with only one specified passwd backend. /para para @@ -111,7 +110,7 @@ LanMan and NT-encrypted passwords as well as a field that stores some account information. This form of password backend does not store any of the MS Windows NT/200x SAM (Security Account Manager) information required to - provide the extended controls that are needed for more comprehensive + provide the extended controls that are needed for more comprehensive interoperation with MS Windows NT4/200x servers. /para @@ -194,7 +193,7 @@ para indextermprimaryrich directory backend/primary/indexterm indextermprimarydistributed account/primary/indexterm - This provides a rich directory backend for distributed account installation. + This provides a rich directory backend for distributed account installation. /para para @@ -240,7 +239,7 @@ /para para -indextermprimaryencrypted passwords/primary/indexterm +indextermprimaryencrypted passwords/primary/indexterm indextermprimaryLanMan/primary/indexterm indextermprimaryplaintext passwords/primary/indexterm indextermprimaryregistry/primary/indexterm @@ -253,11 +252,11 @@ indextermprimaryUNIX-style encrypted passwords/primary/indexterm indextermprimaryconverted/primary/indexterm Many people ask why Samba cannot simply use the UNIX password database. Windows requires - passwords that are encrypted in its own format. The UNIX passwords can't be converted to + passwords that are encrypted in its own format. The UNIX passwords can't be converted to UNIX-style encrypted passwords. Because of that, you can't use the standard UNIX user database, and you have to store the LanMan and NT hashes somewhere else. /para - + para indextermprimarydifferently encrypted passwords/primary/indexterm indextermprimaryprofile/primary/indexterm @@ -267,7 +266,7 @@ user that is not stored in a UNIX user database: for example, workstations the user may logon from, the location where the user's profile is stored, and so on. Samba retrieves and stores this information using a smbconfoption name=passdb backend/. Commonly available backends are LDAP, - tdbsam, and plain text file. For more information, see the man page for smb.conf; regarding the + tdbsam, and plain text file. For more information, see the man page for smb.conf; regarding the smbconfoption name=passdb backend/ parameter. /para @@ -294,7 +293,7 @@ sect2 titleImportant Notes About Security/title - + para indextermprimarySMB password encryption/primary/indexterm indextermprimaryclear-text passwords/primary/indexterm @@ -304,7 +303,7 @@ The UNIX and SMB password encryption techniques seem similar on the surface. This similarity is, however, only skin deep. The UNIX scheme typically sends clear-text passwords over the network when logging in. This is bad. The SMB encryption scheme - never sends the clear-text password over the network, but it does store the 16-byte + never
svn commit: samba r24360 - in branches: SAMBA_3_2/source/librpc/ndr SAMBA_3_2_0/source/librpc/ndr
Author: gd Date: 2007-08-13 13:05:17 + (Mon, 13 Aug 2007) New Revision: 24360 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24360 Log: Make ndr_print_debug_helper() output readable. Guenther Modified: branches/SAMBA_3_2/source/librpc/ndr/ndr.c branches/SAMBA_3_2_0/source/librpc/ndr/ndr.c Changeset: Modified: branches/SAMBA_3_2/source/librpc/ndr/ndr.c === --- branches/SAMBA_3_2/source/librpc/ndr/ndr.c 2007-08-13 09:49:03 UTC (rev 24359) +++ branches/SAMBA_3_2/source/librpc/ndr/ndr.c 2007-08-13 13:05:17 UTC (rev 24360) @@ -199,10 +199,10 @@ va_end(ap); for (i=0;indr-depth;i++) { - DEBUG(0,()); + DEBUGADD(0,()); } - DEBUG(0,(%s\n, s)); + DEBUGADD(0,(%s\n, s)); free(s); } Modified: branches/SAMBA_3_2_0/source/librpc/ndr/ndr.c === --- branches/SAMBA_3_2_0/source/librpc/ndr/ndr.c2007-08-13 09:49:03 UTC (rev 24359) +++ branches/SAMBA_3_2_0/source/librpc/ndr/ndr.c2007-08-13 13:05:17 UTC (rev 24360) @@ -199,10 +199,10 @@ va_end(ap); for (i=0;indr-depth;i++) { - DEBUG(0,()); + DEBUGADD(0,()); } - DEBUG(0,(%s\n, s)); + DEBUGADD(0,(%s\n, s)); free(s); }
svn commit: samba r24362 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 14:40:56 + (Mon, 13 Aug 2007) New Revision: 24362 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24362 Log: Initialize padding also when no params are sent back Modified: branches/SAMBA_3_2/source/smbd/trans2.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/trans2.c === --- branches/SAMBA_3_2/source/smbd/trans2.c 2007-08-13 14:29:44 UTC (rev 24361) +++ branches/SAMBA_3_2/source/smbd/trans2.c 2007-08-13 14:40:56 UTC (rev 24362) @@ -699,13 +699,15 @@ SSVAL(req-outbuf,smb_drdisp, pd - pdata); } + /* Initialize the padding for alignment */ + + if (alignment_offset != 0) { + memset(smb_buf(req-outbuf), 0, alignment_offset); + } + /* Copy the param bytes into the packet */ if(params_sent_thistime) { - if (alignment_offset != 0) { - memset(smb_buf(req-outbuf), 0, - alignment_offset); - } memcpy((smb_buf(req-outbuf)+alignment_offset), pp, params_sent_thistime); }
svn commit: samba r24363 - in branches/SAMBA_4_0/source/param: .
Author: kai Date: 2007-08-13 14:43:18 + (Mon, 13 Aug 2007) New Revision: 24363 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24363 Log: Add template shell and template homedir settings to smb.conf Modified: branches/SAMBA_4_0/source/param/loadparm.c Changeset: Modified: branches/SAMBA_4_0/source/param/loadparm.c === --- branches/SAMBA_4_0/source/param/loadparm.c 2007-08-13 14:40:56 UTC (rev 24362) +++ branches/SAMBA_4_0/source/param/loadparm.c 2007-08-13 14:43:18 UTC (rev 24363) @@ -131,6 +131,8 @@ char *ntptr_providor; char *szWinbindSeparator; char *szWinbinddSocketDirectory; + char *szTemplateShell; + char *szTemplateHomedir; int bWinbindSealedPipes; char *webapps_directory; int tls_enabled; @@ -563,6 +565,8 @@ {winbind separator, P_STRING, P_GLOBAL, Globals.szWinbindSeparator, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER }, {winbindd socket directory, P_STRING, P_GLOBAL, Globals.szWinbinddSocketDirectory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER }, {winbind sealed pipes, P_BOOL, P_GLOBAL, Globals.bWinbindSealedPipes, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER }, + {template shell, P_STRING, P_GLOBAL, Globals.szTemplateShell, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER }, + {template homedir, P_STRING, P_GLOBAL, Globals.szTemplateHomedir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER }, {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0} }; @@ -696,6 +700,8 @@ do_parameter(winbind separator, \\, NULL); do_parameter(winbind sealed pipes, True, NULL); do_parameter(winbindd socket directory, dyn_WINBINDD_SOCKET_DIR, NULL); + do_parameter(template shell, /bin/false, NULL); + do_parameter(template homedir, /home/%WORKGROUP%/%ACCOUNTNAME%, NULL); do_parameter(client signing, Yes, NULL); do_parameter(server signing, auto, NULL); @@ -854,6 +860,8 @@ _PUBLIC_ FN_GLOBAL_STRING(lp_wins_url, Globals.szWINS_URL) _PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbind_separator, Globals.szWinbindSeparator) _PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbindd_socket_directory, Globals.szWinbinddSocketDirectory) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_shell, Globals.szTemplateShell) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_homedir, Globals.szTemplateHomedir) _PUBLIC_ FN_GLOBAL_BOOL(lp_winbind_sealed_pipes, Globals.bWinbindSealedPipes) _PUBLIC_ FN_GLOBAL_STRING(lp_private_dir, Globals.szPrivateDir) _PUBLIC_ FN_GLOBAL_STRING(lp_serverstring, Globals.szServerString)
svn commit: samba r24361 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 14:29:44 + (Mon, 13 Aug 2007) New Revision: 24361 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24361 Log: Push reply_prep_legacy down in reply_nttrans[s] Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 13:05:17 UTC (rev 24360) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 14:29:44 UTC (rev 24361) @@ -3188,23 +3188,18 @@ START_PROFILE(SMBnttrans); - if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBnttrans); - return; - } - - if (CVAL(inbuf, smb_wct) 19) { + if (req-wct 19) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); END_PROFILE(SMBnttrans); return; } - pscnt = IVAL(inbuf,smb_nt_ParameterCount); - psoff = IVAL(inbuf,smb_nt_ParameterOffset); - dscnt = IVAL(inbuf,smb_nt_DataCount); - dsoff = IVAL(inbuf,smb_nt_DataOffset); - function_code = SVAL( inbuf, smb_nt_Function); + size = smb_len(req-inbuf) + 4; + pscnt = IVAL(req-inbuf,smb_nt_ParameterCount); + psoff = IVAL(req-inbuf,smb_nt_ParameterOffset); + dscnt = IVAL(req-inbuf,smb_nt_DataCount); + dsoff = IVAL(req-inbuf,smb_nt_DataOffset); + function_code = SVAL(req-inbuf, smb_nt_Function); if (IS_IPC(conn) (function_code != NT_TRANSACT_CREATE)) { reply_doserror(req, ERRSRV, ERRaccess); @@ -3212,7 +3207,7 @@ return; } - result = allow_new_trans(conn-pending_trans, SVAL(inbuf, smb_mid)); + result = allow_new_trans(conn-pending_trans, req-mid); if (!NT_STATUS_IS_OK(result)) { DEBUG(2, (Got invalid nttrans request: %s\n, nt_errstr(result))); reply_nterror(req, result); @@ -3228,17 +3223,17 @@ state-cmd = SMBnttrans; - state-mid = SVAL(inbuf,smb_mid); - state-vuid = SVAL(inbuf,smb_uid); - state-total_data = IVAL(inbuf, smb_nt_TotalDataCount); + state-mid = req-mid; + state-vuid = req-vuid; + state-total_data = IVAL(req-inbuf, smb_nt_TotalDataCount); state-data = NULL; - state-total_param = IVAL(inbuf, smb_nt_TotalParameterCount); + state-total_param = IVAL(req-inbuf, smb_nt_TotalParameterCount); state-param = NULL; - state-max_data_return = IVAL(inbuf,smb_nt_MaxDataCount); - state-max_param_return = IVAL(inbuf,smb_nt_MaxParameterCount); + state-max_data_return = IVAL(req-inbuf,smb_nt_MaxDataCount); + state-max_param_return = IVAL(req-inbuf,smb_nt_MaxParameterCount); /* setup count is in *words* */ - state-setup_count = 2*CVAL(inbuf,smb_nt_SetupCount); + state-setup_count = 2*CVAL(req-inbuf,smb_nt_SetupCount); state-setup = NULL; state-call = function_code; @@ -3247,9 +3242,9 @@ * state-setup_count. Ensure this is so as a sanity check. */ - if(CVAL(inbuf, smb_wct) != 19 + (state-setup_count/2)) { + if(req-wct != 19 + (state-setup_count/2)) { DEBUG(2,(Invalid smb_wct %d in nttrans call (should be %d)\n, - CVAL(inbuf, smb_wct), 19 + (state-setup_count/2))); +req-wct, 19 + (state-setup_count/2))); goto bad_param; } @@ -3277,11 +3272,12 @@ } if ((dsoff+dscnt dsoff) || (dsoff+dscnt dscnt)) goto bad_param; - if ((smb_base(inbuf)+dsoff+dscnt inbuf + size) || - (smb_base(inbuf)+dsoff+dscnt smb_base(inbuf))) + if ((smb_base(req-inbuf)+dsoff+dscnt + (char *)req-inbuf + size) || + (smb_base(req-inbuf)+dsoff+dscnt smb_base(req-inbuf))) goto bad_param; - memcpy(state-data,smb_base(inbuf)+dsoff,dscnt); + memcpy(state-data,smb_base(req-inbuf)+dsoff,dscnt); } if (state-total_param) { @@ -3298,11 +3294,12 @@ } if ((psoff+pscnt psoff) || (psoff+pscnt pscnt)) goto bad_param; - if ((smb_base(inbuf)+psoff+pscnt inbuf + size) || - (smb_base(inbuf)+psoff+pscnt smb_base(inbuf))) + if ((smb_base(req-inbuf)+psoff+pscnt + (char *)req-inbuf + size) || + (smb_base(req-inbuf)+psoff+pscnt smb_base(req-inbuf))) goto bad_param; - memcpy(state-param,smb_base(inbuf)+psoff,pscnt); + memcpy(state-param,smb_base(req-inbuf)+psoff,pscnt); }
svn commit: samba r24365 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:22:26 + (Mon, 13 Aug 2007) New Revision: 24365 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24365 Log: Implemet backend for wbinfo -S, sid2uid Added: branches/SAMBA_4_0/source/winbind/wb_sid2uid.c Modified: branches/SAMBA_4_0/source/winbind/config.mk Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:18:34 UTC (rev 24364) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:22:26 UTC (rev 24365) @@ -16,6 +16,7 @@ wb_dom_info_trusted.o \ wb_sid2domain.o \ wb_name2domain.o \ + wb_sid2uid.o \ wb_connect_lsa.o \ wb_connect_sam.o \ wb_cmd_lookupname.o \ Added: branches/SAMBA_4_0/source/winbind/wb_sid2uid.c === --- branches/SAMBA_4_0/source/winbind/wb_sid2uid.c 2007-08-13 15:18:34 UTC (rev 24364) +++ branches/SAMBA_4_0/source/winbind/wb_sid2uid.c 2007-08-13 15:22:26 UTC (rev 24365) @@ -0,0 +1,78 @@ +/* + Unix SMB/CIFS implementation. + + Map a SID to a uid + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. +*/ + +#include includes.h +#include libcli/composite/composite.h +#include winbind/wb_server.h +#include smbd/service_task.h +#include winbind/wb_helper.h +#include libcli/security/proto.h + +struct sid2uid_state { + struct composite_context *ctx; + struct wbsrv_service *service; + uid_t uid; +}; + +struct composite_context *wb_sid2uid_send(TALLOC_CTX *mem_ctx, + struct wbsrv_service *service, const struct dom_sid *sid) +{ + struct composite_context *result; + struct sid2uid_state *state; + + DEBUG(5, (wb_sid2uid_send called\n)); + + result = composite_create(mem_ctx, service-task-event_ctx); + if (!result) return NULL; + + state = talloc(result, struct sid2uid_state); + if(composite_nomem(state, result)) return result; + + state-ctx = result; + result-private_data = state; + state-service = service; + + /*FIXME: This is a stub so far. */ + state-ctx-status = dom_sid_split_rid(result, sid, NULL, state-uid); + if(!composite_is_ok(state-ctx)) return result; + + DEBUG(5, (Rid is %d\n, state-uid)); + + composite_done(state-ctx); + return result; +} + +NTSTATUS wb_sid2uid_recv(struct composite_context *ctx, uid_t *uid) +{ + NTSTATUS status = composite_wait(ctx); + + DEBUG(5, (wb_sid2uid_recv called\n)); + + if (NT_STATUS_IS_OK(status)) { + struct sid2uid_state *state = + talloc_get_type(ctx-private_data, + struct sid2uid_state); + *uid = state-uid; + } + talloc_free(ctx); + return status; +} +
svn commit: samba r24366 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:27:37 + (Mon, 13 Aug 2007) New Revision: 24366 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24366 Log: Implemet backend for wbinfo -Y, sid2gid Added: branches/SAMBA_4_0/source/winbind/wb_sid2gid.c Modified: branches/SAMBA_4_0/source/winbind/config.mk Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:22:26 UTC (rev 24365) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:27:37 UTC (rev 24366) @@ -17,6 +17,7 @@ wb_sid2domain.o \ wb_name2domain.o \ wb_sid2uid.o \ + wb_sid2gid.o \ wb_connect_lsa.o \ wb_connect_sam.o \ wb_cmd_lookupname.o \ Added: branches/SAMBA_4_0/source/winbind/wb_sid2gid.c === --- branches/SAMBA_4_0/source/winbind/wb_sid2gid.c 2007-08-13 15:22:26 UTC (rev 24365) +++ branches/SAMBA_4_0/source/winbind/wb_sid2gid.c 2007-08-13 15:27:37 UTC (rev 24366) @@ -0,0 +1,76 @@ +/* + Unix SMB/CIFS implementation. + + Map a SID to a gid + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. +*/ + +#include includes.h +#include libcli/composite/composite.h +#include winbind/wb_server.h +#include smbd/service_task.h +#include winbind/wb_helper.h +#include libcli/security/proto.h + +struct sid2gid_state { + struct composite_context *ctx; + struct wbsrv_service *service; + gid_t gid; +}; + +struct composite_context *wb_sid2gid_send(TALLOC_CTX *mem_ctx, + struct wbsrv_service *service, const struct dom_sid *sid) +{ + struct composite_context *result; + struct sid2gid_state *state; + + DEBUG(5, (wb_sid2gid_send called\n)); + + result = composite_create(mem_ctx, service-task-event_ctx); + if (!result) return NULL; + + state = talloc(result, struct sid2gid_state); + if(composite_nomem(state, result)) return result; + + state-ctx = result; + result-private_data = state; + state-service = service; + + /*FIXME: This is a stub so far. */ + state-ctx-status = dom_sid_split_rid(result, sid, NULL, state-gid); + if(!composite_is_ok(state-ctx)) return result; + + composite_done(state-ctx); + return result; +} + +NTSTATUS wb_sid2gid_recv(struct composite_context *ctx, gid_t *gid) +{ + NTSTATUS status = composite_wait(ctx); + + DEBUG(5, (wb_sid2gid_recv called\n)); + + if (NT_STATUS_IS_OK(status)) { + struct sid2gid_state *state = + talloc_get_type(ctx-private_data, + struct sid2gid_state); + *gid = state-gid; + } + talloc_free(ctx); + return status; +} +
svn commit: samba r24364 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:18:34 + (Mon, 13 Aug 2007) New Revision: 24364 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24364 Log: Remove sync call from name2domain, bump debug level to 5 Modified: branches/SAMBA_4_0/source/winbind/wb_name2domain.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/wb_name2domain.c === --- branches/SAMBA_4_0/source/winbind/wb_name2domain.c 2007-08-13 14:43:18 UTC (rev 24363) +++ branches/SAMBA_4_0/source/winbind/wb_name2domain.c 2007-08-13 15:18:34 UTC (rev 24364) @@ -74,7 +74,7 @@ struct name2domain_state); struct wb_sid_object *sid; - DEBUG(1, (name2domain_recv_sid called\n)); + DEBUG(5, (name2domain_recv_sid called\n)); state-ctx-status = wb_cmd_lookupname_recv(ctx, state, sid); if(!composite_is_ok(state-ctx)) return; @@ -91,7 +91,7 @@ struct name2domain_state); struct wbsrv_domain *domain; - DEBUG(1, (name2domain_recv_domain called\n)); + DEBUG(5, (name2domain_recv_domain called\n)); state-ctx-status = wb_sid2domain_recv(ctx, domain); if(!composite_is_ok(state-ctx)) return; @@ -106,7 +106,7 @@ { NTSTATUS status = composite_wait(ctx); - DEBUG(1, (wb_name2domain_recv called\n)); + DEBUG(5, (wb_name2domain_recv called\n)); if (NT_STATUS_IS_OK(status)) { struct name2domain_state *state = @@ -118,13 +118,3 @@ return status; } -NTSTATUS wb_name2domain(TALLOC_CTX *mem_ctx, struct wbsrv_service *service, - const char* name, struct wbsrv_domain **result) -{ - struct composite_context *c; - - c = wb_name2domain_send(mem_ctx, service, name); - - return wb_name2domain_recv(c, result); -} -
svn commit: samba r24367 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 15:40:37 + (Mon, 13 Aug 2007) New Revision: 24367 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24367 Log: Push reply_prep_legacy into handle_nttrans Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 15:27:37 UTC (rev 24366) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 15:40:37 UTC (rev 24367) @@ -3046,16 +3046,26 @@ } #endif /* HAVE_SYS_QUOTAS */ -static int handle_nttrans(connection_struct *conn, - struct trans_state *state, - char *inbuf, char *outbuf, int size, int bufsize) +static void handle_nttrans(connection_struct *conn, + struct trans_state *state, + struct smb_request *req) { - int outsize; + int outsize = -1; + char *inbuf, *outbuf; + int size, bufsize; + if (Protocol = PROTOCOL_NT1) { - SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | 0x40); /* IS_LONG_NAME */ + req-flags2 |= 0x40; /* IS_LONG_NAME */ + SSVAL(req-inbuf,smb_flg2,req-flags2); } + if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBnttrans); + return; + } + /* Now we must call the relevant NT_TRANS function */ switch(state-call) { case NT_TRANSACT_CREATE: @@ -3163,9 +3173,11 @@ /* Error in request */ DEBUG(0,(handle_nttrans: Unknown request %d in nttrans call\n, state-call)); - return ERROR_DOS(ERRSRV,ERRerror); + reply_doserror(req, ERRSRV, ERRerror); + return; } - return outsize; + reply_post_legacy(req, outsize); + return; } / @@ -3174,7 +3186,6 @@ void reply_nttrans(connection_struct *conn, struct smb_request *req) { - int outsize = 0; uint32 pscnt; uint32 psoff; uint32 dscnt; @@ -3182,10 +3193,8 @@ uint16 function_code; NTSTATUS result; struct trans_state *state; + int size; - char *inbuf, *outbuf; - int size, bufsize; - START_PROFILE(SMBnttrans); if (req-wct 19) { @@ -3332,20 +3341,12 @@ dump_data(10, (uint8 *)state-setup, state-setup_count); } - if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBnttrans); - return; - } - if ((state-received_data == state-total_data) (state-received_param == state-total_param)) { - outsize = handle_nttrans(conn, state, inbuf, outbuf, -size, bufsize); + handle_nttrans(conn, state, req); SAFE_FREE(state-param); SAFE_FREE(state-data); TALLOC_FREE(state); - reply_post_legacy(req, outsize); END_PROFILE(SMBnttrans); return; } @@ -3354,10 +3355,9 @@ /* We need to send an interim response then receive the rest of the parameter/data bytes */ - outsize = set_message(inbuf,outbuf,0,0,False); - show_msg(outbuf); + reply_outbuf(req, 0, 0); + show_msg((char *)req-outbuf); END_PROFILE(SMBnttrans); - reply_post_legacy(req, outsize); return; bad_param: @@ -3377,12 +3377,10 @@ void reply_nttranss(connection_struct *conn, struct smb_request *req) { - int outsize = 0; unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp; struct trans_state *state; - char *inbuf, *outbuf; - int size, bufsize; + int size; START_PROFILE(SMBnttranss); @@ -3461,9 +3459,10 @@ goto bad_param; if (ddisp state-total_data) goto bad_param; - if ((smb_base(inbuf) + doff + dcnt + if ((smb_base(req-inbuf) + doff + dcnt (char *)req-inbuf + size) || - (smb_base(inbuf) + doff + dcnt smb_base(inbuf))) + (smb_base(req-inbuf) + doff + dcnt + smb_base(req-inbuf))) goto bad_param; if (state-data + ddisp state-data) goto bad_param; @@ -3478,32 +3477,18 @@ return; } - if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { - reply_nterror(req,
svn commit: samba r24370 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:49:09 + (Mon, 13 Aug 2007) New Revision: 24370 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24370 Log: Implement wbinfo -i backend (getpwnam) Added: branches/SAMBA_4_0/source/winbind/wb_cmd_getpwnam.c Modified: branches/SAMBA_4_0/source/winbind/config.mk branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:41:31 UTC (rev 24369) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:49:09 UTC (rev 24370) @@ -23,6 +23,7 @@ wb_cmd_lookupname.o \ wb_cmd_lookupsid.o \ wb_cmd_getdcname.o \ + wb_cmd_getpwnam.o \ wb_cmd_userdomgroups.o \ wb_cmd_usersids.o \ wb_cmd_list_trustdom.o \ Added: branches/SAMBA_4_0/source/winbind/wb_cmd_getpwnam.c === --- branches/SAMBA_4_0/source/winbind/wb_cmd_getpwnam.c 2007-08-13 15:41:31 UTC (rev 24369) +++ branches/SAMBA_4_0/source/winbind/wb_cmd_getpwnam.c 2007-08-13 15:49:09 UTC (rev 24370) @@ -0,0 +1,194 @@ +/* + Unix SMB/CIFS implementation. + + Command backend for wbinfo -i + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. +*/ + +#include includes.h +#include libcli/composite/composite.h +#include winbind/wb_server.h +#include winbind/wb_async_helpers.h +#include winbind/wb_helper.h +#include smbd/service_task.h +#include nsswitch/winbindd_nss.h +#include libnet/libnet_proto.h +#include param/proto.h +#include libcli/security/proto.h + +struct cmd_getpwnam_state { + struct composite_context *ctx; + struct wbsrv_service *service; + char *name; + char *workgroup_name; + struct dom_sid *group_sid; + + struct winbindd_pw *result; +}; + +static void cmd_getpwnam_recv_domain(struct composite_context *ctx); +static void cmd_getpwnam_recv_user_info(struct composite_context *ctx); +static void cmd_getpwnam_recv_uid(struct composite_context *ctx); +static void cmd_getpwnam_recv_gid(struct composite_context *ctx); + +struct composite_context *wb_cmd_getpwnam_send(TALLOC_CTX *mem_ctx, +struct wbsrv_service *service, +const char *name) +{ + struct composite_context *result, *ctx; + struct cmd_getpwnam_state *state; + + DEBUG(5, (wb_cmd_getpwnam_send called\n)); + + result = composite_create(mem_ctx, service-task-event_ctx); + if (!result) return NULL; + + state = talloc(result, struct cmd_getpwnam_state); + if (composite_nomem(state, result)) return result; + state-ctx = result; + result-private_data = state; + state-service = service; + state-name = talloc_strdup(state, name); + if(composite_nomem(state-name, result)) return result; + + ctx = wb_name2domain_send(state, service, name); + if (composite_nomem(ctx, result)) return result; + + composite_continue(result, ctx, cmd_getpwnam_recv_domain, state); + return result; +} + +static void cmd_getpwnam_recv_domain(struct composite_context *ctx) +{ + struct cmd_getpwnam_state *state = talloc_get_type( + ctx-async.private_data, struct cmd_getpwnam_state); + struct wbsrv_domain *domain; + struct libnet_UserInfo *user_info; + char *user_dom, *user_name; + bool ok; + + state-ctx-status = wb_name2domain_recv(ctx, domain); + if(!composite_is_ok(state-ctx)) return; + + user_info = talloc(state, struct libnet_UserInfo); + if (composite_nomem(user_info, state-ctx)) return; + + ok= wb_samba3_split_username(state, state-name, user_dom, user_name); + if(!ok){ + composite_error(state-ctx, NT_STATUS_OBJECT_NAME_INVALID); + return; + } + + user_info-in.user_name = user_name; + user_info-in.domain_name = domain-libnet_ctx-samr.name; + state-workgroup_name = talloc_strdup(state, + domain-libnet_ctx-samr.name); + if(composite_nomem(state-workgroup_name, state-ctx)) return; + + ctx =
svn commit: samba r24368 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 15:41:29 + (Mon, 13 Aug 2007) New Revision: 24368 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24368 Log: Push down reply_prep_legacy one level Not pretty, but necessary to convert the calls one by one Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 15:40:37 UTC (rev 24367) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 15:41:29 UTC (rev 24368) @@ -3050,95 +3050,176 @@ struct trans_state *state, struct smb_request *req) { - int outsize = -1; - - char *inbuf, *outbuf; - int size, bufsize; - if (Protocol = PROTOCOL_NT1) { req-flags2 |= 0x40; /* IS_LONG_NAME */ SSVAL(req-inbuf,smb_flg2,req-flags2); } - if (!reply_prep_legacy(req, inbuf, outbuf, size, bufsize)) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBnttrans); - return; - } - /* Now we must call the relevant NT_TRANS function */ switch(state-call) { case NT_TRANSACT_CREATE: { + char *inbuf, *outbuf; + int size, bufsize; + START_PROFILE(NT_transact_create); - outsize = call_nt_transact_create(conn, inbuf, outbuf, - size, bufsize, - state-setup, state-setup_count, - state-param, state-total_param, - state-data, state-total_data, - state-max_data_return); + + if (!reply_prep_legacy(req, inbuf, outbuf, size, + bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBnttrans); + return; + } + + reply_post_legacy( + req, + call_nt_transact_create( + conn, inbuf, outbuf, + size, bufsize, + state-setup, state-setup_count, + state-param, state-total_param, + state-data, state-total_data, + state-max_data_return)); + END_PROFILE(NT_transact_create); break; } case NT_TRANSACT_IOCTL: { + char *inbuf, *outbuf; + int size, bufsize; + START_PROFILE(NT_transact_ioctl); - outsize = call_nt_transact_ioctl(conn, inbuf, outbuf, -size, bufsize, -state-setup, state-setup_count, -state-param, state-total_param, -state-data, state-total_data, state-max_data_return); + + if (!reply_prep_legacy(req, inbuf, outbuf, size, + bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBnttrans); + return; + } + + reply_post_legacy( + req, + call_nt_transact_ioctl( + conn, inbuf, outbuf, + size, bufsize, + state-setup, state-setup_count, + state-param, state-total_param, + state-data, state-total_data, + state-max_data_return)); + END_PROFILE(NT_transact_ioctl); break; } case NT_TRANSACT_SET_SECURITY_DESC: { + char *inbuf, *outbuf; + int size, bufsize; + START_PROFILE(NT_transact_set_security_desc); - outsize = call_nt_transact_set_security_desc(conn, inbuf, outbuf, -size,
svn commit: samba r24369 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:41:31 + (Mon, 13 Aug 2007) New Revision: 24369 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24369 Log: Don't use goto in wb_name2domain, fix wb_samba3_split_names call. Missed this one on my previous name2domain cleanup patch. Modified: branches/SAMBA_4_0/source/winbind/wb_name2domain.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/wb_name2domain.c === --- branches/SAMBA_4_0/source/winbind/wb_name2domain.c 2007-08-13 15:41:29 UTC (rev 24368) +++ branches/SAMBA_4_0/source/winbind/wb_name2domain.c 2007-08-13 15:41:31 UTC (rev 24369) @@ -41,30 +41,30 @@ struct composite_context *result, *ctx; struct name2domain_state *state; char *user_dom, *user_name; + bool ok; DEBUG(5, (wb_name2domain_send called\n)); result = composite_create(mem_ctx, service-task-event_ctx); - if (result == NULL) goto failed; + if (!result) return NULL; state = talloc(result, struct name2domain_state); - if (state == NULL) goto failed; + if (composite_nomem(state, result)) return result; state-ctx = result; result-private_data = state; state-service = service; - if(!wb_samba3_split_username(state, name, user_dom, user_name)) - goto failed; + ok = wb_samba3_split_username(state, name, user_dom, user_name); + if(!ok) { + composite_error(state-ctx, NT_STATUS_OBJECT_NAME_INVALID); + return result; + } ctx = wb_cmd_lookupname_send(state, service, user_dom, user_name); - if (ctx == NULL) goto failed; + if (composite_nomem(ctx, state-ctx)) return result; composite_continue(result, ctx, name2domain_recv_sid, state); return result; - -failed: - talloc_free(result); - return NULL; } static void name2domain_recv_sid(struct composite_context *ctx)
svn commit: samba r24371 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 15:58:41 + (Mon, 13 Aug 2007) New Revision: 24371 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24371 Log: Actually add the glue to make wbinfo -S and wbinfo -Y work Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 15:49:09 UTC (rev 24370) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 15:58:41 UTC (rev 24371) @@ -750,3 +750,79 @@ s3call-response.result = WINBINDD_OK; return NT_STATUS_OK; } + +static void sid2uid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_sid2uid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call-wbconn-listen_socket-service; + struct dom_sid *sid; + + DEBUG(1, (wbsrv_samba3_sid2uid called\n)); + + sid = dom_sid_parse_talloc(s3call, s3call-request.data.sid); + NT_STATUS_HAVE_NO_MEMORY(sid); + + ctx = wb_sid2uid_send(s3call, service, sid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx-async.fn = sid2uid_recv; + ctx-async.private_data = s3call; + s3call-flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void sid2uid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx-async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + + DEBUG(1, (sid2uid_recv called\n)); + + status = wb_sid2uid_recv(ctx, s3call-response.data.uid); + + wbsrv_samba3_async_epilogue(status, s3call); +} + +static void sid2gid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_sid2gid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call-wbconn-listen_socket-service; + struct dom_sid *sid; + + DEBUG(1, (wbsrv_samba3_sid2gid called\n)); + + sid = dom_sid_parse_talloc(s3call, s3call-request.data.sid); + NT_STATUS_HAVE_NO_MEMORY(sid); + + ctx = wb_sid2gid_send(s3call, service, sid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx-async.fn = sid2gid_recv; + ctx-async.private_data = s3call; + s3call-flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void sid2gid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx-async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + + DEBUG(1, (sid2gid_recv called\n)); + + status = wb_sid2gid_recv(ctx, s3call-response.data.gid); + + wbsrv_samba3_async_epilogue(status, s3call); +} Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 15:49:09 UTC (rev 24370) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 15:58:41 UTC (rev 24371) @@ -157,6 +157,14 @@ case WINBINDD_ENDGRENT: return wbsrv_samba3_endgrent(s3call); + case WINBINDD_SID_TO_UID: + case WINBINDD_DUAL_SID2UID: + return wbsrv_samba3_sid2uid(s3call); + + case WINBINDD_SID_TO_GID: + case WINBINDD_DUAL_SID2GID: + return wbsrv_samba3_sid2gid(s3call); + /* Unimplemented commands */ case WINBINDD_PAM_CHAUTHTOK: @@ -165,8 +173,6 @@ case WINBINDD_LIST_USERS: case WINBINDD_LIST_GROUPS: case WINBINDD_LOOKUPRIDS: - case WINBINDD_SID_TO_UID: - case WINBINDD_SID_TO_GID: case WINBINDD_SIDS_TO_XIDS: case WINBINDD_UID_TO_SID: case WINBINDD_GID_TO_SID: @@ -182,8 +188,6 @@ case WINBINDD_WINS_BYNAME: case WINBINDD_GETGRLST: case WINBINDD_INIT_CONNECTION: - case WINBINDD_DUAL_SID2UID: - case WINBINDD_DUAL_SID2GID: case WINBINDD_DUAL_SIDS2XIDS: case WINBINDD_DUAL_UID2SID: case WINBINDD_DUAL_GID2SID:
svn commit: samba r24373 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 16:20:26 + (Mon, 13 Aug 2007) New Revision: 24373 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24373 Log: Implement backend for wbinfo -G (gid2sid) Modified: branches/SAMBA_4_0/source/winbind/config.mk branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 16:07:47 UTC (rev 24372) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 16:20:26 UTC (rev 24373) @@ -16,6 +16,7 @@ wb_dom_info_trusted.o \ wb_sid2domain.o \ wb_name2domain.o \ + wb_gid2sid.o \ wb_sid2uid.o \ wb_sid2gid.o \ wb_uid2sid.o \ Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 16:07:47 UTC (rev 24372) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 16:20:26 UTC (rev 24373) @@ -875,3 +875,48 @@ wbsrv_samba3_async_epilogue(status, s3call); } +static void gid2sid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_gid2sid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call-wbconn-listen_socket-service; + + DEBUG(5, (wbsrv_samba3_gid2sid called\n)); + + ctx = wb_gid2sid_send(s3call, service, s3call-request.data.gid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx-async.fn = gid2sid_recv; + ctx-async.private_data = s3call; + s3call-flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void gid2sid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx-async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + struct dom_sid *sid; + char *sid_str; + + DEBUG(5, (gid2sid_recv called\n)); + + status = wb_gid2sid_recv(ctx, s3call, sid); + if(NT_STATUS_IS_OK(status)) { + sid_str = dom_sid_string(s3call, sid); + + if (sid_str == NULL) + wbsrv_samba3_async_epilogue(NT_STATUS_NO_MEMORY,s3call); + + WBSRV_SAMBA3_SET_STRING(s3call-response.data.sid.sid, sid_str); + s3call-response.data.sid.type = SID_NAME_DOMAIN; + } + + wbsrv_samba3_async_epilogue(status, s3call); +} + Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 16:07:47 UTC (rev 24372) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 16:20:26 UTC (rev 24373) @@ -169,6 +169,10 @@ case WINBINDD_DUAL_UID2SID: return wbsrv_samba3_uid2sid(s3call); + case WINBINDD_GID_TO_SID: + case WINBINDD_DUAL_GID2SID: + return wbsrv_samba3_gid2sid(s3call); + /* Unimplemented commands */ case WINBINDD_PAM_CHAUTHTOK: @@ -178,7 +182,6 @@ case WINBINDD_LIST_GROUPS: case WINBINDD_LOOKUPRIDS: case WINBINDD_SIDS_TO_XIDS: - case WINBINDD_GID_TO_SID: case WINBINDD_ALLOCATE_UID: case WINBINDD_ALLOCATE_GID: case WINBINDD_SET_MAPPING: @@ -192,7 +195,6 @@ case WINBINDD_GETGRLST: case WINBINDD_INIT_CONNECTION: case WINBINDD_DUAL_SIDS2XIDS: - case WINBINDD_DUAL_GID2SID: case WINBINDD_DUAL_SET_MAPPING: case WINBINDD_DUAL_SET_HWM: case WINBINDD_DUAL_DUMP_MAPS:
svn commit: samba r24374 - in branches/SAMBA_4_0/source/nsswitch: .
Author: kai Date: 2007-08-13 16:26:39 + (Mon, 13 Aug 2007) New Revision: 24374 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24374 Log: Add a getpwuid lookup to wbinfo Modified: branches/SAMBA_4_0/source/nsswitch/wbinfo.c Changeset: Modified: branches/SAMBA_4_0/source/nsswitch/wbinfo.c === --- branches/SAMBA_4_0/source/nsswitch/wbinfo.c 2007-08-13 16:20:26 UTC (rev 24373) +++ branches/SAMBA_4_0/source/nsswitch/wbinfo.c 2007-08-13 16:26:39 UTC (rev 24374) @@ -154,6 +154,35 @@ return True; } +/* pull pwent info for a given uid */ +static BOOL wbinfo_get_uidinfo(int uid) +{ + struct winbindd_request request; + struct winbindd_response response; + NSS_STATUS result; + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + request.data.uid = uid; + + result = winbindd_request(WINBINDD_GETPWUID, request, response); + + if (result != NSS_STATUS_SUCCESS) + return False; + + d_printf( %s:%s:%d:%d:%s:%s:%s\n, + response.data.pw.pw_name, + response.data.pw.pw_passwd, + response.data.pw.pw_uid, + response.data.pw.pw_gid, + response.data.pw.pw_gecos, + response.data.pw.pw_dir, + response.data.pw.pw_shell ); + + return True; +} + /* pull grent for a given group */ static BOOL wbinfo_get_groupinfo(char *group) { @@ -973,6 +1002,7 @@ OPT_SEPARATOR, OPT_LIST_ALL_DOMAINS, OPT_LIST_OWN_DOMAIN, + OPT_UID_INFO, OPT_GROUP_INFO, }; @@ -1009,6 +1039,7 @@ { sequence, 0, POPT_ARG_NONE, 0, OPT_SEQUENCE, Show sequence numbers of all domains }, { domain-info, 'D', POPT_ARG_STRING, string_arg, 'D', Show most of the info we have about the domain }, { user-info, 'i', POPT_ARG_STRING, string_arg, 'i', Get user info, USER }, + { uid-info, 0, POPT_ARG_INT, int_arg, OPT_UID_INFO, Get user info from uid, UID }, { group-info, 0, POPT_ARG_STRING, string_arg, OPT_GROUP_INFO, Get group info, GROUP }, { user-groups, 'r', POPT_ARG_STRING, string_arg, 'r', Get user groups, USER }, { user-domgroups, 0, POPT_ARG_STRING, string_arg, @@ -1146,6 +1177,13 @@ goto done; } break; + case OPT_UID_INFO: + if ( !wbinfo_get_uidinfo(int_arg)) { + d_fprintf(stderr, Could not get info for uid + %d\n, int_arg); + goto done; + } + break; case OPT_GROUP_INFO: if ( !wbinfo_get_groupinfo(string_arg)) { d_fprintf(stderr, Could not get info for
svn commit: samba r24372 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 16:07:47 + (Mon, 13 Aug 2007) New Revision: 24372 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24372 Log: Implement backend for wbinfo -U Added: branches/SAMBA_4_0/source/winbind/wb_uid2sid.c Modified: branches/SAMBA_4_0/source/winbind/config.mk branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 15:58:41 UTC (rev 24371) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 16:07:47 UTC (rev 24372) @@ -18,6 +18,7 @@ wb_name2domain.o \ wb_sid2uid.o \ wb_sid2gid.o \ + wb_uid2sid.o \ wb_connect_lsa.o \ wb_connect_sam.o \ wb_cmd_lookupname.o \ Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 15:58:41 UTC (rev 24371) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c 2007-08-13 16:07:47 UTC (rev 24372) @@ -826,3 +826,52 @@ wbsrv_samba3_async_epilogue(status, s3call); } + +static void uid2sid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_uid2sid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call-wbconn-listen_socket-service; + + DEBUG(5, (wbsrv_samba3_uid2sid called\n)); + + ctx = wb_uid2sid_send(s3call, service, s3call-request.data.uid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx-async.fn = uid2sid_recv; + ctx-async.private_data = s3call; + s3call-flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void uid2sid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx-async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + struct dom_sid *sid; + char *sid_str; + + DEBUG(5, (uid2sid_recv called\n)); + + status = wb_uid2sid_recv(ctx, s3call, sid); + if(NT_STATUS_IS_OK(status)) { + sid_str = dom_sid_string(s3call, sid); + + /* If the conversion failed, bail out with a failure. */ + if (sid_str == NULL) + wbsrv_samba3_async_epilogue(NT_STATUS_NO_MEMORY,s3call); + + /* But we assume this worked, so we'll set the string. Work +* done. */ + WBSRV_SAMBA3_SET_STRING(s3call-response.data.sid.sid, sid_str); + s3call-response.data.sid.type = SID_NAME_USER; + } + + wbsrv_samba3_async_epilogue(status, s3call); +} + Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c === --- branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 15:58:41 UTC (rev 24371) +++ branches/SAMBA_4_0/source/winbind/wb_samba3_protocol.c 2007-08-13 16:07:47 UTC (rev 24372) @@ -165,6 +165,10 @@ case WINBINDD_DUAL_SID2GID: return wbsrv_samba3_sid2gid(s3call); + case WINBINDD_UID_TO_SID: + case WINBINDD_DUAL_UID2SID: + return wbsrv_samba3_uid2sid(s3call); + /* Unimplemented commands */ case WINBINDD_PAM_CHAUTHTOK: @@ -174,7 +178,6 @@ case WINBINDD_LIST_GROUPS: case WINBINDD_LOOKUPRIDS: case WINBINDD_SIDS_TO_XIDS: - case WINBINDD_UID_TO_SID: case WINBINDD_GID_TO_SID: case WINBINDD_ALLOCATE_UID: case WINBINDD_ALLOCATE_GID: @@ -189,7 +192,6 @@ case WINBINDD_GETGRLST: case WINBINDD_INIT_CONNECTION: case WINBINDD_DUAL_SIDS2XIDS: - case WINBINDD_DUAL_UID2SID: case WINBINDD_DUAL_GID2SID: case WINBINDD_DUAL_SET_MAPPING: case WINBINDD_DUAL_SET_HWM: Added: branches/SAMBA_4_0/source/winbind/wb_uid2sid.c === --- branches/SAMBA_4_0/source/winbind/wb_uid2sid.c 2007-08-13 15:58:41 UTC (rev 24371) +++ branches/SAMBA_4_0/source/winbind/wb_uid2sid.c 2007-08-13 16:07:47 UTC (rev 24372) @@ -0,0 +1,78 @@ +/* + Unix SMB/CIFS implementation. + + Command backend for wbinfo -U + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied
svn commit: samba-docs r1149 - in trunk/Samba3-HOWTO: .
Author: jht Date: 2007-08-13 16:00:27 + (Mon, 13 Aug 2007) New Revision: 1149 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-docsrev=1149 Log: Fix a typo. Thanks to Thomas Bork. Modified: trunk/Samba3-HOWTO/TOSHARG-Passdb.xml Changeset: Modified: trunk/Samba3-HOWTO/TOSHARG-Passdb.xml === --- trunk/Samba3-HOWTO/TOSHARG-Passdb.xml 2007-08-13 13:14:52 UTC (rev 1148) +++ trunk/Samba3-HOWTO/TOSHARG-Passdb.xml 2007-08-13 16:00:27 UTC (rev 1149) @@ -1647,7 +1647,7 @@ para indextermprimarypdbedit/primary/indexterm -indextermprimaryiccount mport/export/primary/indexterm +indextermprimaryaccount import/export/primary/indexterm indextermprimaryauthentication/primary/indexterm The commandpdbedit/command tool allows import/export of authentication (account) databases from one backend to another. For example, to import/export accounts from an
svn commit: samba r24376 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 16:45:51 + (Mon, 13 Aug 2007) New Revision: 24376 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24376 Log: Missed this file from the checkin, sorry. Added: branches/SAMBA_4_0/source/winbind/wb_gid2sid.c Changeset: Added: branches/SAMBA_4_0/source/winbind/wb_gid2sid.c === --- branches/SAMBA_4_0/source/winbind/wb_gid2sid.c 2007-08-13 16:34:29 UTC (rev 24375) +++ branches/SAMBA_4_0/source/winbind/wb_gid2sid.c 2007-08-13 16:45:51 UTC (rev 24376) @@ -0,0 +1,78 @@ +/* + Unix SMB/CIFS implementation. + + Command backend for wbinfo -G + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. +*/ + +#include includes.h +#include libcli/composite/composite.h +#include winbind/wb_server.h +#include smbd/service_task.h +#include winbind/wb_helper.h +#include libcli/security/proto.h + +struct gid2sid_state { + struct composite_context *ctx; + struct wbsrv_service *service; + struct dom_sid *sid; +}; + +struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx, + struct wbsrv_service *service, uid_t uid) +{ + struct composite_context *result; + struct gid2sid_state *state; + + DEBUG(5, (wb_gid2sid_send called\n)); + + result = composite_create(mem_ctx, service-task-event_ctx); + if (!result) return NULL; + + state = talloc(mem_ctx, struct gid2sid_state); + if (composite_nomem(state, result)) return result; + + state-ctx = result; + result-private_data = state; + state-service = service; + + /* FIXME: This is a stub so far. +* We cheat by just using the uid as RID with the domain SID.*/ + state-sid = dom_sid_add_rid(result, service-primary_sid, uid); + if (composite_nomem(state-sid, state-ctx)) return result; + + composite_done(state-ctx); + return result; +} + +NTSTATUS wb_gid2sid_recv(struct composite_context *ctx, TALLOC_CTX *mem_ctx, + struct dom_sid **sid) +{ + NTSTATUS status = composite_wait(ctx); + + DEBUG(5, (wb_gid2sid_recv called.\n)); + + if (NT_STATUS_IS_OK(status)) { + struct gid2sid_state *state = + talloc_get_type(ctx-private_data, + struct gid2sid_state); + *sid = talloc_steal(mem_ctx, state-sid); + } + talloc_free(ctx); + return status; +} +
svn commit: samba r24375 - in branches/SAMBA_4_0/source/winbind: .
Author: kai Date: 2007-08-13 16:34:29 + (Mon, 13 Aug 2007) New Revision: 24375 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24375 Log: Implement backend for wbinfo --uid-infp (getpwuid) Added: branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c Modified: branches/SAMBA_4_0/source/winbind/config.mk branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c Changeset: Modified: branches/SAMBA_4_0/source/winbind/config.mk === --- branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 16:26:39 UTC (rev 24374) +++ branches/SAMBA_4_0/source/winbind/config.mk 2007-08-13 16:34:29 UTC (rev 24375) @@ -26,6 +26,7 @@ wb_cmd_lookupsid.o \ wb_cmd_getdcname.o \ wb_cmd_getpwnam.o \ + wb_cmd_getpwuid.o \ wb_cmd_userdomgroups.o \ wb_cmd_usersids.o \ wb_cmd_list_trustdom.o \ Added: branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c === --- branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c 2007-08-13 16:26:39 UTC (rev 24374) +++ branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c 2007-08-13 16:34:29 UTC (rev 24375) @@ -0,0 +1,202 @@ +/* + Unix SMB/CIFS implementation. + + Backend for getpwuid + + Copyright (C) Kai Blin 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. +*/ + +#include includes.h +#include libcli/composite/composite.h +#include winbind/wb_server.h +#include winbind/wb_async_helpers.h +#include winbind/wb_helper.h +#include smbd/service_task.h +#include nsswitch/winbindd_nss.h +#include libnet/libnet_proto.h +#include param/proto.h +#include libcli/security/proto.h +#include auth/credentials/credentials.h + +struct cmd_getpwuid_state { + struct composite_context *ctx; + struct wbsrv_service *service; + uid_t uid; + char *workgroup; + struct wbsrv_domain *domain; + + struct winbindd_pw *result; +}; + +static void cmd_getpwuid_recv_sid(struct composite_context *ctx); +static void cmd_getpwuid_recv_domain(struct composite_context *ctx); +static void cmd_getpwuid_recv_user_info(struct composite_context *ctx); +static void cmd_getpwuid_recv_gid(struct composite_context *ctx); + +/* Get the SID using the uid */ + +struct composite_context *wb_cmd_getpwuid_send(TALLOC_CTX *mem_ctx, +struct wbsrv_service *service, +uid_t uid) +{ + struct composite_context *ctx, *result; + struct cmd_getpwuid_state *state; + + DEBUG(5, (wb_cmd_getpwnam_send called\n)); + + result = composite_create(mem_ctx, service-task-event_ctx); + if (!result) return NULL; + + state = talloc(result, struct cmd_getpwuid_state); + if (composite_nomem(state, result)) return result; + state-ctx = result; + result-private_data = state; + state-service = service; + state-uid = uid; + + ctx = wb_uid2sid_send(state, service, uid); + if (composite_nomem(ctx, state-ctx)) return result; + + composite_continue(result, ctx, cmd_getpwuid_recv_sid, state); + return result; +} + + +/* Receive the sid and get the domain structure with it */ + +static void cmd_getpwuid_recv_sid(struct composite_context *ctx) +{ + struct cmd_getpwuid_state *state = + talloc_get_type(ctx-async.private_data, + struct cmd_getpwuid_state); + struct dom_sid *sid; + + DEBUG(5, (cmd_getpwuid_recv_sid called %p\n, ctx-private_data)); + + state-ctx-status = wb_uid2sid_recv(ctx, state, sid); + if (!composite_is_ok(state-ctx)) return; + + ctx = wb_sid2domain_send(state, state-service, sid); + + composite_continue(state-ctx, ctx, cmd_getpwuid_recv_domain, state); +} + +/* Receive the domain struct and call libnet to get the user info struct */ + +static void cmd_getpwuid_recv_domain(struct composite_context *ctx) +{ + struct cmd_getpwuid_state *state = + talloc_get_type(ctx-async.private_data, + struct cmd_getpwuid_state); + struct libnet_UserInfo *user_info; + + DEBUG(5, (cmd_getpwuid_recv_domain called\n)); + + state-ctx-status =
svn commit: samba r24377 - in branches/SAMBA_3_0_26/source/libsmb: .
Author: derrell Date: 2007-08-13 17:45:03 + (Mon, 13 Aug 2007) New Revision: 24377 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24377 Log: - ACL retrieval provided incomplete information because the buffer pointer was incremented too far in some circumstances. In these cases, only the first of multiple concatenated strings would be seen. - Working on bug 4649 pertaining to delete an ACL, this fixes the reported crash. It appears to have been an incomplete switchover from malloc to talloc, as the memory was still being freed with SAFE_FREE. Deleting ACLs still doesn't work. Although a valid request is sent to the server and a SUCCESS response is returned, the method that's used in libsmbclient for deleting ACLs seems to be incorrect. In looking at the samba4 torture tests, it appears that we should be turning on the INHERIT flag if we want to delete the ACL. (I could use some assistance on the proper flags to send, from anyone familiar with this stuff.) Derrell Modified: branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c 2007-08-13 16:45:51 UTC (rev 24376) +++ branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c 2007-08-13 17:45:03 UTC (rev 24377) @@ -4537,6 +4537,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_owner) { @@ -4584,6 +4585,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_group) { @@ -4629,6 +4631,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_acl) { @@ -4719,6 +4722,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } } @@ -4793,6 +4797,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_size) { @@ -4837,6 +4842,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_create_time @@ -4879,6 +4885,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_access_time) { @@ -4920,6 +4927,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_write_time) { @@ -4961,6 +4969,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_change_time) { @@ -5002,6 +5011,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_inode) { @@ -5046,6 +5056,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } /* Restore name pointer to its original value */ @@ -5140,8 +5151,8 @@ switch (mode) { case SMBC_XATTR_MODE_REMOVE_ALL: old-dacl-num_aces = 0; -SAFE_FREE(old-dacl-aces); -SAFE_FREE(old-dacl); +prs_mem_free(old-dacl-aces); +prs_mem_free(old-dacl); old-dacl = NULL; dacl = old-dacl; break; @@ -5160,8 +5171,8 @@ } old-dacl-num_aces--; if (old-dacl-num_aces == 0) { - SAFE_FREE(old-dacl-aces); - SAFE_FREE(old-dacl); +prs_mem_free(old-dacl-aces); +prs_mem_free(old-dacl); old-dacl = NULL; }
svn commit: samba r24378 - in branches/SAMBA_3_0_25/source/libsmb: .
Author: derrell Date: 2007-08-13 17:46:11 + (Mon, 13 Aug 2007) New Revision: 24378 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24378 Log: - ACL retrieval provided incomplete information because the buffer pointer was incremented too far in some circumstances. In these cases, only the first of multiple concatenated strings would be seen. - Working on bug 4649 pertaining to delete an ACL, this fixes the reported crash. It appears to have been an incomplete switchover from malloc to talloc, as the memory was still being freed with SAFE_FREE. Deleting ACLs still doesn't work. Although a valid request is sent to the server and a SUCCESS response is returned, the method that's used in libsmbclient for deleting ACLs seems to be incorrect. In looking at the samba4 torture tests, it appears that we should be turning on the INHERIT flag if we want to delete the ACL. (I could use some assistance on the proper flags to send, from anyone familiar with this stuff.) Derrell Modified: branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c 2007-08-13 17:45:03 UTC (rev 24377) +++ branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c 2007-08-13 17:46:11 UTC (rev 24378) @@ -4537,6 +4537,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_owner) { @@ -4584,6 +4585,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_group) { @@ -4629,6 +4631,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_acl) { @@ -4719,6 +4722,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } } @@ -4793,6 +4797,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_size) { @@ -4837,6 +4842,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_create_time @@ -4879,6 +4885,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_access_time) { @@ -4920,6 +4927,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_write_time) { @@ -4961,6 +4969,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_change_time) { @@ -5002,6 +5011,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_inode) { @@ -5046,6 +5056,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } /* Restore name pointer to its original value */ @@ -5140,8 +5151,8 @@ switch (mode) { case SMBC_XATTR_MODE_REMOVE_ALL: old-dacl-num_aces = 0; -SAFE_FREE(old-dacl-aces); -SAFE_FREE(old-dacl); +prs_mem_free(old-dacl-aces); +prs_mem_free(old-dacl); old-dacl = NULL; dacl = old-dacl; break; @@ -5160,8 +5171,8 @@ } old-dacl-num_aces--; if (old-dacl-num_aces == 0) { - SAFE_FREE(old-dacl-aces); - SAFE_FREE(old-dacl); +prs_mem_free(old-dacl-aces); +prs_mem_free(old-dacl); old-dacl = NULL; }
svn commit: samba r24379 - in branches/SAMBA_3_0_26/source/libsmb: .
Author: derrell Date: 2007-08-13 18:07:26 + (Mon, 13 Aug 2007) New Revision: 24379 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24379 Log: - Apply patch from SATOH Fumiyasu to fix bug 4750. smbc_telldir_ctx() was not returning a value useful to smbc_lseekdir_ctx(). Derrell Modified: branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c 2007-08-13 17:46:11 UTC (rev 24378) +++ branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c 2007-08-13 18:07:26 UTC (rev 24379) @@ -3445,8 +3445,6 @@ smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir) { - off_t ret_val; /* Squash warnings about cast */ - if (!context || !context-internal || !context-internal-_initialized) { @@ -3469,12 +3467,16 @@ } +/* See if we're already at the end. */ +if (dir-dir_next == NULL) { +/* We are. */ +return -1; +} + /* * We return the pointer here as the offset */ - ret_val = (off_t)(long)dir-dir_next; - return ret_val; - +return (off_t)(long)dir-dir_next-dirent; } /* @@ -3545,6 +3547,11 @@ } +if (offset == -1) { /* Seek to the end of the list */ +dir-dir_next = NULL; +return 0; +} + /* Now, run down the list and make sure that the entry is OK */ /* This may need to be changed if we change the format of the list */
svn commit: samba r24380 - in branches/SAMBA_3_0_25/source/libsmb: .
Author: derrell Date: 2007-08-13 18:07:48 + (Mon, 13 Aug 2007) New Revision: 24380 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24380 Log: - Apply patch from SATOH Fumiyasu to fix bug 4750. smbc_telldir_ctx() was not returning a value useful to smbc_lseekdir_ctx(). Derrell Modified: branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c 2007-08-13 18:07:26 UTC (rev 24379) +++ branches/SAMBA_3_0_25/source/libsmb/libsmbclient.c 2007-08-13 18:07:48 UTC (rev 24380) @@ -3445,8 +3445,6 @@ smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir) { - off_t ret_val; /* Squash warnings about cast */ - if (!context || !context-internal || !context-internal-_initialized) { @@ -3469,12 +3467,16 @@ } +/* See if we're already at the end. */ +if (dir-dir_next == NULL) { +/* We are. */ +return -1; +} + /* * We return the pointer here as the offset */ - ret_val = (off_t)(long)dir-dir_next; - return ret_val; - +return (off_t)(long)dir-dir_next-dirent; } /* @@ -3545,6 +3547,11 @@ } +if (offset == -1) { /* Seek to the end of the list */ +dir-dir_next = NULL; +return 0; +} + /* Now, run down the list and make sure that the entry is OK */ /* This may need to be changed if we change the format of the list */
svn commit: samba r24381 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 19:03:52 + (Mon, 13 Aug 2007) New Revision: 24381 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24381 Log: Push reply_prep_legacy into call_nt_transact_create Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 18:07:48 UTC (rev 24380) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:03:52 UTC (rev 24381) @@ -1283,10 +1283,12 @@ Reply to a NT_TRANSACT_CREATE call (needs to process SD's). / -static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count, uint32 max_data_count) +static void call_nt_transact_create(connection_struct *conn, + struct smb_request *req, + uint16 **ppsetup, uint32 setup_count, + char **ppparams, uint32 parameter_count, + char **ppdata, uint32 data_count, + uint32 max_data_count) { pstring fname; char *params = *ppparams; @@ -1317,24 +1319,35 @@ char *pdata = NULL; NTSTATUS status; size_t param_len; - struct smb_request req; struct case_semantics_state *case_state = NULL; + char *inbuf, *outbuf; + int length, bufsize; + DEBUG(5,(call_nt_transact_create\n)); + if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + return; + } + /* * If it's an IPC, use the pipe handler. */ if (IS_IPC(conn)) { if (lp_nt_pipe_support()) { - return do_nt_transact_create_pipe(conn, inbuf, outbuf, length, - bufsize, + reply_post_legacy( + req, + do_nt_transact_create_pipe( + conn, inbuf, outbuf, length, bufsize, ppsetup, setup_count, ppparams, parameter_count, - ppdata, data_count); + ppdata, data_count)); + return; } else { - return ERROR_DOS(ERRDOS,ERRnoaccess); + reply_doserror(req, ERRDOS, ERRnoaccess); + return; } } @@ -1344,11 +1357,10 @@ if(parameter_count 54) { DEBUG(0,(call_nt_transact_create - insufficient parameters (%u)\n, (unsigned int)parameter_count)); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + return; } - init_smb_request(req, (uint8 *)inbuf); - flags = IVAL(params,0); access_mask = IVAL(params,8); file_attributes = IVAL(params,20); @@ -1365,25 +1377,29 @@ (ea_len + sd_len ea_len) || (ea_len + sd_len sd_len)) { DEBUG(10,(call_nt_transact_create - ea_len = %u, sd_len = %u, data_count = %u\n, (unsigned int)ea_len, (unsigned int)sd_len, (unsigned int)data_count )); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + return; } if (ea_len) { if (!lp_ea_support(SNUM(conn))) { DEBUG(10,(call_nt_transact_create - ea_len = %u but EA's not supported.\n, (unsigned int)ea_len )); - return ERROR_NT(NT_STATUS_EAS_NOT_SUPPORTED); + reply_nterror(req, NT_STATUS_EAS_NOT_SUPPORTED); + return; } if (ea_len 10) { DEBUG(10,(call_nt_transact_create - ea_len = %u - too small (should be more than 10)\n, (unsigned int)ea_len )); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + return; } } if (create_options FILE_OPEN_BY_FILE_ID) { - return ERROR_NT(NT_STATUS_NOT_SUPPORTED); + reply_nterror(req,
svn commit: samba r24382 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 19:22:07 + (Mon, 13 Aug 2007) New Revision: 24382 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24382 Log: Remove reply_prep_legacy from call_nt_transact_create Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:03:52 UTC (rev 24381) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:22:07 UTC (rev 24382) @@ -339,61 +339,15 @@ } / - Reply to an NT create and X call on a pipe -- this will die when all - callers are converted to nt_open_pipe_new + Reply to an NT create and X call on a pipe / -static int nt_open_pipe(char *fname, connection_struct *conn, - char *inbuf, char *outbuf, int *ppnum) +static void nt_open_pipe(char *fname, connection_struct *conn, +struct smb_request *req, int *ppnum) { smb_np_struct *p = NULL; - uint16 vuid = SVAL(inbuf, smb_uid); int i; - - DEBUG(4,(nt_open_pipe: Opening pipe %s.\n, fname)); - - /* See if it is one we want to handle. */ - if (lp_disable_spoolss() strequal(fname, \\spoolss)) { - return(ERROR_BOTH(NT_STATUS_OBJECT_NAME_NOT_FOUND,ERRDOS,ERRbadpipe)); - } - - for( i = 0; known_nt_pipes[i]; i++ ) { - if( strequal(fname,known_nt_pipes[i])) { - break; - } - } - - if ( known_nt_pipes[i] == NULL ) { - return(ERROR_BOTH(NT_STATUS_OBJECT_NAME_NOT_FOUND,ERRDOS,ERRbadpipe)); - } - - /* Strip \\ off the name. */ - fname++; - - DEBUG(3,(nt_open_pipe: Known pipe %s opening.\n, fname)); - - p = open_rpc_pipe_p(fname, conn, vuid); - if (!p) { - return(ERROR_DOS(ERRSRV,ERRnofids)); - } - - /* TODO: Add pipe to db */ - - if ( !store_pipe_opendb( p ) ) { - DEBUG(3,(nt_open_pipe: failed to store %s pipe open.\n, fname)); - } - - *ppnum = p-pnum; - return 0; -} - -static void nt_open_pipe_new(char *fname, connection_struct *conn, -struct smb_request *req, int *ppnum) -{ - smb_np_struct *p = NULL; - int i; - DEBUG(4,(nt_open_pipe: Opening pipe %s.\n, fname)); /* See if it is one we want to handle. */ @@ -452,7 +406,7 @@ srvstr_pull_buf((char *)req-inbuf, req-flags2, fname, smb_buf(req-inbuf), sizeof(fname), STR_TERMINATE); - nt_open_pipe_new(fname, conn, req, pnum); + nt_open_pipe(fname, conn, req, pnum); if (req-outbuf) { /* error reply */ @@ -1098,14 +1052,14 @@ Reply to a NT_TRANSACT_CREATE call to open a pipe. / -static int do_nt_transact_create_pipe( connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count) +static void do_nt_transact_create_pipe(connection_struct *conn, + struct smb_request *req, + uint16 **ppsetup, uint32 setup_count, + char **ppparams, uint32 parameter_count, + char **ppdata, uint32 data_count) { pstring fname; char *params = *ppparams; - int ret; int pnum = -1; char *p = NULL; NTSTATUS status; @@ -1118,20 +1072,25 @@ if(parameter_count 54) { DEBUG(0,(do_nt_transact_create_pipe - insufficient parameters (%u)\n, (unsigned int)parameter_count)); - return ERROR_DOS(ERRDOS,ERRnoaccess); + reply_doserror(req, ERRDOS, ERRnoaccess); + return; } flags = IVAL(params,0); - srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, params+53, + srvstr_get_path(params, req-flags2, fname, params+53, sizeof(fname), parameter_count-53, STR_TERMINATE, status); if (!NT_STATUS_IS_OK(status)) { - return ERROR_NT(status); + reply_nterror(req, status); + return; } - if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, pnum)) != 0) { - return ret; + nt_open_pipe(fname, conn, req, pnum); + + if (req-outbuf) { + /* Error return */ + return; }
svn commit: samba r24383 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 19:58:28 + (Mon, 13 Aug 2007) New Revision: 24383 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24383 Log: Convert call_nt_transact_ioctl to the new API Modified: branches/SAMBA_3_2/source/smbd/nttrans.c branches/SAMBA_3_2/source/smbd/reply.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:22:07 UTC (rev 24382) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:58:28 UTC (rev 24383) @@ -2402,10 +2402,12 @@ Reply to NT IOCTL / -static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count, uint32 max_data_count) +static void call_nt_transact_ioctl(connection_struct *conn, + struct smb_request *req, + uint16 **ppsetup, uint32 setup_count, + char **ppparams, uint32 parameter_count, + char **ppdata, uint32 data_count, + uint32 max_data_count) { uint32 function; uint16 fidnum; @@ -2417,7 +2419,8 @@ if (setup_count != 8) { DEBUG(3,(call_nt_transact_ioctl: invalid setup count %d\n, setup_count)); - return ERROR_NT(NT_STATUS_NOT_SUPPORTED); + reply_nterror(req, NT_STATUS_NOT_SUPPORTED); + return; } function = IVAL(*ppsetup, 0); @@ -2440,9 +2443,8 @@ so we can know if we need to pre-allocate or not */ DEBUG(10,(FSCTL_SET_SPARSE: called on FID[0x%04X](but not implemented)\n, fidnum)); - send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, NULL, - 0); - return -1; + send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + return; case FSCTL_CREATE_OR_GET_OBJECT_ID: { @@ -2454,18 +2456,22 @@ DEBUG(10,(FSCTL_CREATE_OR_GET_OBJECT_ID: called on FID[0x%04X]\n,fidnum)); - FSP_BELONGS_CONN(fsp, conn); + if (!fsp_belongs_conn(conn, req, fsp, current_user)) { + return; + } data_count = 64; pdata = nttrans_realloc(ppdata, data_count); if (pdata == NULL) { - return ERROR_NT(NT_STATUS_NO_MEMORY); + reply_nterror(req, NT_STATUS_NO_MEMORY); + return; } push_file_id_16(pdata, fsp-file_id); memcpy(pdata+16,create_volume_objectid(conn,objid),16); push_file_id_16(pdata+32, fsp-file_id); - send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, pdata, data_count); - return -1; + send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, + pdata, data_count); + return; } case FSCTL_GET_REPARSE_POINT: @@ -2474,7 +2480,8 @@ */ DEBUG(10,(FSCTL_GET_REPARSE_POINT: called on FID[0x%04X](but not implemented)\n,fidnum)); - return ERROR_NT(NT_STATUS_NOT_A_REPARSE_POINT); + reply_nterror(req, NT_STATUS_NOT_A_REPARSE_POINT); + return; case FSCTL_SET_REPARSE_POINT: /* pretend this fail - I'm assuming this because of the FSCTL_GET_REPARSE_POINT case. @@ -2482,7 +2489,8 @@ */ DEBUG(10,(FSCTL_SET_REPARSE_POINT: called on FID[0x%04X](but not implemented)\n,fidnum)); - return ERROR_NT(NT_STATUS_NOT_A_REPARSE_POINT); + reply_nterror(req, NT_STATUS_NOT_A_REPARSE_POINT); + return; case FSCTL_GET_SHADOW_COPY_DATA: /* don't know if this name is right...*/ { @@ -2503,12 +2511,15 @@ uint32 i; char *cur_pdata; - FSP_BELONGS_CONN(fsp,conn); + if (!fsp_belongs_conn(conn, req, fsp, current_user)) { + return; + } if (max_data_count 16) { DEBUG(0,(FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) 16 is invalid!\n, max_data_count)); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + return;
svn commit: samba r24384 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 19:59:00 + (Mon, 13 Aug 2007) New Revision: 24384 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24384 Log: Convert call_nt_transact_set_security_desc to the new API Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:58:28 UTC (rev 24383) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:59:00 UTC (rev 24384) @@ -2356,10 +2356,15 @@ Reply to set a security descriptor. Map to UNIX perms or POSIX ACLs. / -static int call_nt_transact_set_security_desc(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count, uint32 max_data_count) +static void call_nt_transact_set_security_desc(connection_struct *conn, + struct smb_request *req, + uint16 **ppsetup, + uint32 setup_count, + char **ppparams, + uint32 parameter_count, + char **ppdata, + uint32 data_count, + uint32 max_data_count) { char *params= *ppparams; char *data = *ppdata; @@ -2368,11 +2373,13 @@ NTSTATUS nt_status; if(parameter_count 8) { - return ERROR_DOS(ERRDOS,ERRbadfunc); + reply_doserror(req, ERRDOS, ERRbadfunc); + return; } if((fsp = file_fsp(SVAL(params,0))) == NULL) { - return ERROR_DOS(ERRDOS,ERRbadfid); + reply_doserror(req, ERRDOS, ERRbadfid); + return; } if(!lp_nt_acl_support(SNUM(conn))) { @@ -2385,17 +2392,19 @@ (unsigned int)security_info_sent )); if (data_count == 0) { - return ERROR_DOS(ERRDOS, ERRnoaccess); + reply_doserror(req, ERRDOS, ERRnoaccess); + return; } if (!NT_STATUS_IS_OK(nt_status = set_sd( fsp, data, data_count, security_info_sent))) { - return ERROR_NT(nt_status); + reply_nterror(req, nt_status); + return; } done: - send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, NULL, 0); - return -1; + send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0); + return; } / @@ -3099,27 +3108,13 @@ case NT_TRANSACT_SET_SECURITY_DESC: { - char *inbuf, *outbuf; - int size, bufsize; - START_PROFILE(NT_transact_set_security_desc); - - if (!reply_prep_legacy(req, inbuf, outbuf, size, - bufsize)) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBnttrans); - return; - } - - reply_post_legacy( - req, - call_nt_transact_set_security_desc( - conn, inbuf, outbuf, - size, bufsize, - state-setup, state-setup_count, - state-param, state-total_param, - state-data, state-total_data, - state-max_data_return)); + call_nt_transact_set_security_desc( + conn, req, + state-setup, state-setup_count, + state-param, state-total_param, + state-data, state-total_data, + state-max_data_return); END_PROFILE(NT_transact_set_security_desc); break; }
svn commit: samba r24385 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-13 20:16:33 + (Mon, 13 Aug 2007) New Revision: 24385 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24385 Log: Convert call_nt_transact_query_security_desc to the new API Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 19:59:00 UTC (rev 24384) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-13 20:16:33 UTC (rev 24385) @@ -2239,10 +2239,15 @@ Reply to query a security descriptor. / -static int call_nt_transact_query_security_desc(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count, uint32 max_data_count) +static void call_nt_transact_query_security_desc(connection_struct *conn, +struct smb_request *req, +uint16 **ppsetup, +uint32 setup_count, +char **ppparams, +uint32 parameter_count, +char **ppdata, +uint32 data_count, +uint32 max_data_count) { char *params = *ppparams; char *data = *ppdata; @@ -2254,12 +2259,14 @@ files_struct *fsp = NULL; if(parameter_count 8) { - return ERROR_DOS(ERRDOS,ERRbadfunc); + reply_doserror(req, ERRDOS, ERRbadfunc); + return; } fsp = file_fsp(SVAL(params,0)); if(!fsp) { - return ERROR_DOS(ERRDOS,ERRbadfid); + reply_doserror(req, ERRDOS, ERRbadfid); + return; } security_info_wanted = IVAL(params,4); @@ -2269,12 +2276,14 @@ params = nttrans_realloc(ppparams, 4); if(params == NULL) { - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } if ((mem_ctx = talloc_init(call_nt_transact_query_security_desc)) == NULL) { DEBUG(0,(call_nt_transact_query_security_desc: talloc_init failed.\n)); - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } /* @@ -2289,7 +2298,8 @@ if (sd_size == 0) { talloc_destroy(mem_ctx); - return(UNIXERROR(ERRDOS,ERRnoaccess)); + reply_unixerror(req, ERRDOS, ERRnoaccess); + return; } DEBUG(3,(call_nt_transact_query_security_desc: sd_size = %lu.\n,(unsigned long)sd_size)); @@ -2298,10 +2308,10 @@ if(max_data_count sd_size) { - send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_BUFFER_TOO_SMALL, - params, 4, *ppdata, 0); + send_nt_replies_new(req, NT_STATUS_BUFFER_TOO_SMALL, + params, 4, *ppdata, 0); talloc_destroy(mem_ctx); - return -1; + return; } /* @@ -2311,7 +2321,8 @@ data = nttrans_realloc(ppdata, sd_size); if(data == NULL) { talloc_destroy(mem_ctx); - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } /* @@ -2338,7 +2349,8 @@ * Return access denied for want of a better error message.. */ talloc_destroy(mem_ctx); - return(UNIXERROR(ERRDOS,ERRnoaccess)); + reply_unixerror(req, ERRDOS, ERRnoaccess); + return; } /* @@ -2347,9 +2359,9 @@ talloc_destroy(mem_ctx); - send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 4, data, - (int)sd_size); - return -1; + send_nt_replies_new(req, NT_STATUS_OK, params, 4, data, + (int)sd_size); + return; } / @@ -3177,28 +3189,13 @@ case NT_TRANSACT_QUERY_SECURITY_DESC: { - char *inbuf, *outbuf; - int size, bufsize; - START_PROFILE(NT_transact_query_security_desc); - - if (!reply_prep_legacy(req, inbuf,
svn commit: samba r24386 - in branches/SAMBA_3_2/source/smbd: .
Author: jra Date: 2007-08-13 20:29:24 + (Mon, 13 Aug 2007) New Revision: 24386 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24386 Log: Piss off Volker (not deliberately) by checking in a reply_mknew - conversion. Sorry vl, remove one of your 15 patches :-). Jeremy. Modified: branches/SAMBA_3_2/source/smbd/process.c branches/SAMBA_3_2/source/smbd/reply.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/process.c === --- branches/SAMBA_3_2/source/smbd/process.c2007-08-13 20:16:33 UTC (rev 24385) +++ branches/SAMBA_3_2/source/smbd/process.c2007-08-13 20:29:24 UTC (rev 24386) @@ -693,7 +693,7 @@ /* 0x00 */ { SMBmkdir,NULL,reply_mkdir,AS_USER | NEED_WRITE}, /* 0x01 */ { SMBrmdir,NULL,reply_rmdir,AS_USER | NEED_WRITE}, /* 0x02 */ { SMBopen,reply_open,NULL,AS_USER }, -/* 0x03 */ { SMBcreate,reply_mknew,NULL,AS_USER}, +/* 0x03 */ { SMBcreate,NULL,reply_mknew,AS_USER}, /* 0x04 */ { SMBclose,NULL,reply_close,AS_USER | CAN_IPC }, /* 0x05 */ { SMBflush,NULL,reply_flush,AS_USER}, /* 0x06 */ { SMBunlink,NULL,reply_unlink,AS_USER | NEED_WRITE }, @@ -705,7 +705,7 @@ /* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER}, /* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER}, /* 0x0e */ { SMBctemp,reply_ctemp,NULL,AS_USER }, -/* 0x0f */ { SMBmknew,reply_mknew,NULL,AS_USER}, +/* 0x0f */ { SMBmknew,NULL,reply_mknew,AS_USER}, /* 0x10 */ { SMBcheckpath,NULL,reply_checkpath,AS_USER}, /* 0x11 */ { SMBexit,NULL,reply_exit,DO_CHDIR}, /* 0x12 */ { SMBlseek,reply_lseek,NULL,AS_USER}, Modified: branches/SAMBA_3_2/source/smbd/reply.c === --- branches/SAMBA_3_2/source/smbd/reply.c 2007-08-13 20:16:33 UTC (rev 24385) +++ branches/SAMBA_3_2/source/smbd/reply.c 2007-08-13 20:29:24 UTC (rev 24386) @@ -1750,61 +1750,76 @@ Reply to a mknew or a create. / -int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) +void reply_mknew(connection_struct *conn, struct smb_request *req) { pstring fname; int com; - int outsize = 0; - uint32 fattr = SVAL(inbuf,smb_vwv0); + uint32 fattr = 0; struct timespec ts[2]; files_struct *fsp; - int oplock_request = CORE_OPLOCK_REQUEST(inbuf); + int oplock_request = 0; SMB_STRUCT_STAT sbuf; NTSTATUS status; uint32 access_mask = FILE_GENERIC_READ | FILE_GENERIC_WRITE; uint32 share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE; uint32 create_disposition; uint32 create_options = 0; - struct smb_request req; START_PROFILE(SMBcreate); - init_smb_request(req, (uint8 *)inbuf); - - com = SVAL(inbuf,smb_com); +if (req-wct 3) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + END_PROFILE(SMBcreate); + return; + } - ts[1] = convert_time_t_to_timespec(srv_make_unix_date3(inbuf + smb_vwv1)); /* mtime. */ + fattr = SVAL(req-inbuf,smb_vwv0); + oplock_request = CORE_OPLOCK_REQUEST(req-inbuf); + com = SVAL(req-inbuf,smb_com); - srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf) + 1, - sizeof(fname), 0, STR_TERMINATE, status); + ts[1] =convert_time_t_to_timespec( + srv_make_unix_date3(req-inbuf + smb_vwv1)); + /* mtime. */ + + srvstr_get_path((char *)req-inbuf, req-flags2, fname, +smb_buf(req-inbuf) + 1, sizeof(fname), 0, + STR_TERMINATE, status); if (!NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); END_PROFILE(SMBcreate); - return ERROR_NT(status); + return; } - status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2) FLAGS2_DFS_PATHNAMES, fname); + status = resolve_dfspath(conn, req-flags2 FLAGS2_DFS_PATHNAMES, + fname); if (!NT_STATUS_IS_OK(status)) { END_PROFILE(SMBcreate); if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath); + reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, + ERRSRV, ERRbadpath); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + return; } status = unix_convert(conn, fname, False, NULL, sbuf); if (!NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); END_PROFILE(SMBcreate); - return ERROR_NT(status); + return; }
Build status as of Tue Aug 14 00:00:02 2007
URL: http://build.samba.org/ --- /home/build/master/cache/broken_results.txt.old 2007-08-13 00:01:09.0 + +++ /home/build/master/cache/broken_results.txt 2007-08-14 00:01:14.0 + @@ -1,4 +1,4 @@ -Build status as of Mon Aug 13 00:00:02 2007 +Build status as of Tue Aug 14 00:00:02 2007 Build counts: Tree Total Broken Panic @@ -16,7 +16,7 @@ rsync30 10 0 samba-docs 0 0 0 samba-gtk3 3 0 -samba4 27 17 2 +samba4 27 16 1 samba_3_231 18 0 smb-build27 27 0 talloc 30 1 0
svn commit: samba r24387 - in branches/SAMBA_3_2/source/smbd: .
Author: jra Date: 2007-08-14 01:45:26 + (Tue, 14 Aug 2007) New Revision: 24387 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24387 Log: Convert readbraw to the new api. Volker, keep checking in your patches please :-). I'll work on SMBreadBmpx tomorrow. Jeremy. Modified: branches/SAMBA_3_2/source/smbd/process.c branches/SAMBA_3_2/source/smbd/reply.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/process.c === --- branches/SAMBA_3_2/source/smbd/process.c2007-08-13 20:29:24 UTC (rev 24386) +++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 01:45:26 UTC (rev 24387) @@ -716,7 +716,7 @@ /* 0x17 */ { NULL, NULL, NULL, 0 }, /* 0x18 */ { NULL, NULL, NULL, 0 }, /* 0x19 */ { NULL, NULL, NULL, 0 }, -/* 0x1a */ { SMBreadbraw,reply_readbraw,NULL,AS_USER}, +/* 0x1a */ { SMBreadbraw,NULL,reply_readbraw,AS_USER}, /* 0x1b */ { SMBreadBmpx,reply_readbmpx,NULL,AS_USER}, /* 0x1c */ { SMBreadBs,NULL, NULL,0 }, /* 0x1d */ { SMBwritebraw,reply_writebraw,NULL,AS_USER}, Modified: branches/SAMBA_3_2/source/smbd/reply.c === --- branches/SAMBA_3_2/source/smbd/reply.c 2007-08-13 20:29:24 UTC (rev 24386) +++ branches/SAMBA_3_2/source/smbd/reply.c 2007-08-14 01:45:26 UTC (rev 24387) @@ -288,6 +288,7 @@ Check if we have a correct fsp pointing to a file. Replacement for the CHECK_FSP macro. / + BOOL check_fsp(connection_struct *conn, struct smb_request *req, files_struct *fsp, struct current_user *user) { @@ -2419,12 +2420,29 @@ } / + Return a readbraw error (4 bytes of zero). +/ + +static void reply_readbraw_error(void) +{ + char header[4]; + SIVAL(header,0,0); + if (write_data(smbd_server_fd(),header,4) != 4) { + fail_readraw(); + } +} + +/ Use sendfile in readbraw. / -void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T startpos, size_t nread, - ssize_t mincount, char *outbuf, int out_buffsize) +void send_file_readbraw(connection_struct *conn, + files_struct *fsp, + SMB_OFF_T startpos, + size_t nread, + ssize_t mincount) { + char *outbuf = NULL; ssize_t ret=0; #if defined(WITH_SENDFILE) @@ -2437,15 +2455,18 @@ if ( (chain_size == 0) (nread 0) (fsp-wcp == NULL) lp_use_sendfile(SNUM(conn)) ) { - DATA_BLOB header; + char header[4]; + DATA_BLOB header_blob; - _smb_setlen(outbuf,nread); - header.data = (uint8 *)outbuf; - header.length = 4; - header.free = NULL; + _smb_setlen(header,nread); + header_blob.data = (uint8 *)header; + header_blob.length = 4; + header_blob.free = NULL; - if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp-fh-fd, header, startpos, nread) == -1) { - /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ + if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp-fh-fd, + header_blob, startpos, nread) == -1) { + /* Returning ENOSYS means no data at all was sent. +* Do this as a normal read. */ if (errno == ENOSYS) { goto normal_readbraw; } @@ -2479,6 +2500,14 @@ normal_readbraw: + outbuf = TALLOC_ARRAY(NULL, char, nread+4); + if (!outbuf) { + DEBUG(0,(send_file_readbraw: TALLOC_ARRAY failed for size %u.\n, + nread+4)); + reply_readbraw_error(); + return; + } + if (nread 0) { ret = read_file(fsp,outbuf+4,startpos,nread); #if 0 /* mincount appears to be ignored in a W2K server. JRA. */ @@ -2493,57 +2522,85 @@ _smb_setlen(outbuf,ret); if (write_data(smbd_server_fd(),outbuf,4+ret) != 4+ret) fail_readraw(); + + TALLOC_FREE(outbuf); } / Reply to a readbraw (core+ protocol). / -int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int out_buffsize) +void reply_readbraw(connection_struct *conn,
svn commit: samba r24388 - in branches/SAMBA_3_2: examples/libsmbclient source/libsmb
Author: derrell Date: 2007-08-14 03:02:34 + (Tue, 14 Aug 2007) New Revision: 24388 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24388 Log: - ACL retrieval provided incomplete information because the buffer pointer was incremented too far in some circumstances. In these cases, only the first of multiple concatenated strings would be seen. - Working on bug 4649 pertaining to delete an ACL, this fixes the reported crash. It appears to have been an incomplete switchover from malloc to talloc, as the memory was still being freed with SAFE_FREE. Deleting ACLs still doesn't work. Although a valid request is sent to the server and a SUCCESS response is returned, the method that's used in libsmbclient for deleting ACLs seems to be incorrect. In looking at the samba4 torture tests, it appears that we should be turning on the INHERIT flag if we want to delete the ACL. (I could use some assistance on the proper flags to send, from anyone familiar with this stuff.) - Apply patch from SATOH Fumiyasu to fix bug 4750. smbc_telldir_ctx() was not returning a value useful to smbc_lseekdir_ctx(). Derrell Modified: branches/SAMBA_3_2/examples/libsmbclient/Makefile branches/SAMBA_3_2/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_2/examples/libsmbclient/Makefile === --- branches/SAMBA_3_2/examples/libsmbclient/Makefile 2007-08-14 01:45:26 UTC (rev 24387) +++ branches/SAMBA_3_2/examples/libsmbclient/Makefile 2007-08-14 03:02:34 UTC (rev 24388) @@ -10,12 +10,12 @@ DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) -LDFLAGS = -L/usr/local/samba/lib +LDFLAGS = -L/usr/local/samba/lib \ + -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so LIBSMBCLIENT = ../../source/bin/libsmbclient.a -ldl -lresolv TESTS= testsmbc \ - tree \ testacl \ testacl2 \ testbrowse \ @@ -26,6 +26,8 @@ testutime \ testread +# tree \ + all: $(TESTS) smbsh testsmbc: testsmbc.o @@ -38,11 +40,11 @@ testacl: testacl.o @echo Linking testacl - $(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $ `gtk-config --libs` $(LIBSMBCLIENT) -lpopt + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt testacl2: testacl2.o @echo Linking testacl2 - $(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $ `gtk-config --libs` $(LIBSMBCLIENT) -lpopt + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt testbrowse: testbrowse.o @echo Linking testbrowse Modified: branches/SAMBA_3_2/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_2/source/libsmb/libsmbclient.c 2007-08-14 01:45:26 UTC (rev 24387) +++ branches/SAMBA_3_2/source/libsmb/libsmbclient.c 2007-08-14 03:02:34 UTC (rev 24388) @@ -3434,8 +3434,6 @@ smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir) { - off_t ret_val; /* Squash warnings about cast */ - if (!context || !context-internal || !context-internal-_initialized) { @@ -3458,12 +3456,16 @@ } +/* See if we're already at the end. */ +if (dir-dir_next == NULL) { +/* We are. */ +return -1; +} + /* * We return the pointer here as the offset */ - ret_val = (off_t)(long)dir-dir_next; - return ret_val; - +return (off_t)(long)dir-dir_next-dirent; } /* @@ -4526,6 +4528,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_owner) { @@ -4573,6 +4576,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_group) { @@ -4618,6 +4622,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_acl) { @@ -4708,6 +4713,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } } @@ -4782,6 +4788,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_size) { @@ -4826,6 +4833,7 @@ buf += n; n_used += n; bufsize -= n; +
svn commit: samba r24389 - in branches/SAMBA_3_2_0: examples/libsmbclient source/libsmb
Author: derrell Date: 2007-08-14 03:02:52 + (Tue, 14 Aug 2007) New Revision: 24389 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24389 Log: - ACL retrieval provided incomplete information because the buffer pointer was incremented too far in some circumstances. In these cases, only the first of multiple concatenated strings would be seen. - Working on bug 4649 pertaining to delete an ACL, this fixes the reported crash. It appears to have been an incomplete switchover from malloc to talloc, as the memory was still being freed with SAFE_FREE. Deleting ACLs still doesn't work. Although a valid request is sent to the server and a SUCCESS response is returned, the method that's used in libsmbclient for deleting ACLs seems to be incorrect. In looking at the samba4 torture tests, it appears that we should be turning on the INHERIT flag if we want to delete the ACL. (I could use some assistance on the proper flags to send, from anyone familiar with this stuff.) - Apply patch from SATOH Fumiyasu to fix bug 4750. smbc_telldir_ctx() was not returning a value useful to smbc_lseekdir_ctx(). Derrell Modified: branches/SAMBA_3_2_0/examples/libsmbclient/Makefile branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c Changeset: Modified: branches/SAMBA_3_2_0/examples/libsmbclient/Makefile === --- branches/SAMBA_3_2_0/examples/libsmbclient/Makefile 2007-08-14 03:02:34 UTC (rev 24388) +++ branches/SAMBA_3_2_0/examples/libsmbclient/Makefile 2007-08-14 03:02:52 UTC (rev 24389) @@ -10,12 +10,12 @@ DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) -LDFLAGS = -L/usr/local/samba/lib +LDFLAGS = -L/usr/local/samba/lib \ + -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so LIBSMBCLIENT = ../../source/bin/libsmbclient.a -ldl -lresolv TESTS= testsmbc \ - tree \ testacl \ testacl2 \ testbrowse \ @@ -26,6 +26,8 @@ testutime \ testread +# tree \ + all: $(TESTS) smbsh testsmbc: testsmbc.o @@ -38,11 +40,11 @@ testacl: testacl.o @echo Linking testacl - $(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $ `gtk-config --libs` $(LIBSMBCLIENT) -lpopt + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt testacl2: testacl2.o @echo Linking testacl2 - $(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $ `gtk-config --libs` $(LIBSMBCLIENT) -lpopt + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt testbrowse: testbrowse.o @echo Linking testbrowse Modified: branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c === --- branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c 2007-08-14 03:02:34 UTC (rev 24388) +++ branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c 2007-08-14 03:02:52 UTC (rev 24389) @@ -3444,8 +3444,6 @@ smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir) { - off_t ret_val; /* Squash warnings about cast */ - if (!context || !context-internal || !context-internal-_initialized) { @@ -3468,12 +3466,16 @@ } +/* See if we're already at the end. */ +if (dir-dir_next == NULL) { +/* We are. */ +return -1; +} + /* * We return the pointer here as the offset */ - ret_val = (off_t)(long)dir-dir_next; - return ret_val; - +return (off_t)(long)dir-dir_next-dirent; } /* @@ -4536,6 +4538,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_owner) { @@ -4583,6 +4586,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_group) { @@ -4628,6 +4632,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_nt_acl) { @@ -4718,6 +4723,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } } @@ -4792,6 +4798,7 @@ buf += n; n_used += n; bufsize -= n; +n = 0; } if (! exclude_dos_size) { @@ -4836,6 +4843,7 @@ buf += n; n_used += n; bufsize -= n; +
svn commit: samba r24390 - in branches/SAMBA_4_0/source/torture/local: .
Author: abartlet Date: 2007-08-14 03:10:22 + (Tue, 14 Aug 2007) New Revision: 24390 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24390 Log: Another attempt to find out why we fail the LOCAL-EVENT test on some build farm hosts. Andrew Bartlett Modified: branches/SAMBA_4_0/source/torture/local/event.c Changeset: Modified: branches/SAMBA_4_0/source/torture/local/event.c === --- branches/SAMBA_4_0/source/torture/local/event.c 2007-08-14 03:02:52 UTC (rev 24389) +++ branches/SAMBA_4_0/source/torture/local/event.c 2007-08-14 03:10:22 UTC (rev 24390) @@ -106,7 +106,7 @@ return true; } else { - torture_fail(test, Failed event loop\n); + torture_fail(test, talloc_asprintf(test, Failed event loop %s\n, strerror(errno))); } } }
svn commit: samba r24391 - in branches/SAMBA_3_2/source/smbd: .
Author: vlendec Date: 2007-08-14 05:58:13 + (Tue, 14 Aug 2007) New Revision: 24391 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24391 Log: Convert call_nt_transact_get_user_quota to the new API Modified: branches/SAMBA_3_2/source/smbd/nttrans.c Changeset: Modified: branches/SAMBA_3_2/source/smbd/nttrans.c === --- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 03:10:22 UTC (rev 24390) +++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 05:58:13 UTC (rev 24391) @@ -2710,10 +2710,15 @@ Reply to get user quota / -static int call_nt_transact_get_user_quota(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize, - uint16 **ppsetup, uint32 setup_count, - char **ppparams, uint32 parameter_count, - char **ppdata, uint32 data_count, uint32 max_data_count) +static void call_nt_transact_get_user_quota(connection_struct *conn, + struct smb_request *req, + uint16 **ppsetup, + uint32 setup_count, + char **ppparams, + uint32 parameter_count, + char **ppdata, + uint32 data_count, + uint32 max_data_count) { NTSTATUS nt_status = NT_STATUS_OK; char *params = *ppparams; @@ -2737,7 +2742,8 @@ if (current_user.ut.uid != 0) { DEBUG(1,(get_user_quota: access_denied service [%s] user [%s]\n, lp_servicename(SNUM(conn)),conn-user)); - return ERROR_DOS(ERRDOS,ERRnoaccess); + reply_doserror(req, ERRDOS, ERRnoaccess); + return; } /* @@ -2746,14 +2752,16 @@ if (parameter_count 4) { DEBUG(0,(TRANSACT_GET_USER_QUOTA: requires %d = 4 bytes parameters\n,parameter_count)); - return ERROR_DOS(ERRDOS,ERRinvalidparam); + reply_doserror(req, ERRDOS, ERRinvalidparam); + return; } /* maybe we can check the quota_fnum */ fsp = file_fsp(SVAL(params,0)); if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) { DEBUG(3,(TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n)); - return ERROR_NT(NT_STATUS_INVALID_HANDLE); + reply_nterror(req, NT_STATUS_INVALID_HANDLE); + return; } /* the NULL pointer checking for fsp-fake_file_handle-pd @@ -2779,7 +2787,8 @@ param_len = 4; params = nttrans_realloc(ppparams, param_len); if(params == NULL) { - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } data_len = 0; @@ -2797,14 +2806,17 @@ start_enum = True; } - if (start_enum vfs_get_user_ntquota_list(fsp,(qt_handle-quota_list))!=0) - return ERROR_DOS(ERRSRV,ERRerror); + if (start_enum vfs_get_user_ntquota_list(fsp,(qt_handle-quota_list))!=0) { + reply_doserror(req, ERRSRV, ERRerror); + return; + } /* Realloc the size of parameters and data we will return */ param_len = 4; params = nttrans_realloc(ppparams, param_len); if(params == NULL) { - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } /* we should not trust the value in max_data_count*/ @@ -2812,7 +2824,8 @@ pdata = nttrans_realloc(ppdata, max_data_count);/* should be max data count from client*/ if(pdata == NULL) { - return ERROR_DOS(ERRDOS,ERRnomem); + reply_doserror(req, ERRDOS, ERRnomem); + return; } entry = pdata; @@ -2873,18 +2886,21 @@ if (data_count 8) {