[Samba] password server DOMDC1 rejected the password: NT_STATUS_LOGON_FAILURE

2007-08-14 Thread glykos
hello list,

I played around with my own problem and it looks like something has
changed in the way users get authenticated from version 3.0.23c to
3.0.25b.

It would help me a lot if someone could point me out to these changes (or
maybe it is bug).

I installed the former version that I had (3.0.23c) and it worked OK out
of the box. The same configuration did not work with 3.0.25b. I changed
the security to domain but again this did not work, either.

The picture that I get right now of the new version is that authenticating
users to remote password server is broken. Can anyone verify this?

Thanks for your help.

Michael

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[Samba] IDMAP and RID problems

2007-08-14 Thread Mark Campbell
I am trying to get the rid back end to work for samba so that the UID 
and GID are predictable.  Here is my smb.conf file.  Anyone see any 
problems with this?  When I use the default of tdb it maps UID just fine 
but this config is not working.


Thanks

Mark

[global]

  workgroup = 
  server string = Samba Server
  security = ads
  encrypt passwords = yes
  realm = XXX.XXX.EDU
  winbind separator = +
   idmap backend = rid
   idmap uid = 1-2
   idmap gid = 1-2
  template shell = /bin/bash
  template homedir = /export/home/%U
  log level = 5
  socket options = TCP_NODELAY


--
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] cannot login from some machines after upgrading from 2 to 3

2007-08-14 Thread Atrox


Atrox wrote:
 
 Hi.
 
 I've got a strange issue here. Some time ago (in march ;) I upgraded my
 FreeBSD-6.0 Samba 2.2 to 3.0 (currently 3.0.24). After creating groupmaps
 and doing all the other upgrade tasks, everything seemed to be alright.
 However, it was not possible to login from some machines (getting error
 for the wrong password). After disjoining and rejoining domain with these
 machines, it was possible again.
 
 Does anybody know, what could be the problem?
 
 There are still some such machines left. One of these is a Windows 2000.
 When I try to login to domain from there, I see the according log-lines
 ending with:
 =
 [2007/06/21 11:40:27, 3] auth/auth.c:check_ntlm_password(270)
   check_ntlm_password: sam authentication for user [silver] succeeded
 [2007/06/21 11:40:27, 5] auth/auth.c:check_ntlm_password(296)
   check_ntlm_password:  PAM Account for user [silver] succeeded
 [2007/06/21 11:40:27, 2] auth/auth.c:check_ntlm_password(309)
   check_ntlm_password:  authentication for user [silver] - [silver] -
 [silver] succeeded
 [2007/06/21 11:40:27, 5] auth/auth_util.c:free_user_info(1867)
   attempting to free (and zero) a user_info structure
 [2007/06/21 11:40:27, 10] auth/auth_util.c:free_user_info(1871)
   structure was created for silver
 =
 
 When checking some successful login's log, I see that information about
 user's groups should follow:
 =
 [2007/06/21 13:24:57, 10] auth/auth_util.c:free_user_info(1871)
   structure was created for silver
 [2007/06/21 13:24:57, 10] auth/auth_util.c:create_local_token(1023)
   Could not convert SID S-1-1-0 to gid, ignoring it
 [2007/06/21 13:24:57, 10] auth/auth_util.c:create_local_token(1023)
   Could not convert SID S-1-5-2 to gid, ignoring it
 [2007/06/21 13:24:57, 10] auth/auth_util.c:create_local_token(1023)
   Could not convert SID S-1-5-32-546 to gid, ignoring it
 [2007/06/21 13:24:57, 10] auth/auth_util.c:debug_nt_user_token(454)
   NT user token of user S-1-5-21-770051042-1162095659-2196661315-501
   contains 4 SIDs
   SID[  0]: S-1-5-21-770051042-1162095659-2196661315-501
   SID[  1]: S-1-1-0
   SID[  2]: S-1-5-2
   SID[  3]: S-1-5-32-546
 =
 
 I checked the server schannel also and verified that this is not the
 case as this w2k's according security settings match server's settings.
 
 What else could cause this?
 
 Thanks in advance,
 Silver
 

Hello.

Update: some machines allow some users to login, but some users not to. Even
though the user is in the users group and can login to Samba with smbclient,
login from (at least some) machines fails.

Hasn't anyone experienced smth like that?

Silver
-- 
View this message in context: 
http://www.nabble.com/cannot-login-from-some-machines-after-upgrading-from-2-to-3-tf3958124.html#a12145332
Sent from the Samba - General mailing list archive at Nabble.com.

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[Samba] Winbind fails to refresh Kerberos tickets (3.0.25b - Fedora Core 5) - 2nd Try

2007-08-14 Thread Rick King

This is the second attempt at sending this. Apologies for any duplicates.

I've got Winbind up and running to authenticate our users against our AD 
and to save kerberos tickets. I have used the winbind refresh tickets = 
yes setting expecting this to renew these kerberos tickets before they 
expire. This does not appear to work. Gnome will pop up a dialog box 
saying that the credentials have expired. At winbind log level 10 I 
can't see anything that suggests the refresh is happening.


I'm running a vanilla samba 3.0.25b on 64bit Fedora Core 5. This was 
locally built into an RPM using the Fedora spec file for 2.0.24 (after 
removing all patches and adding the extra files that 3.0.25b has)


Is there some setting I'm missing or is it something more complex? I'd 
very much appreciate any help I can get in getting this working.


Many Thanks,

Rick King

Config/Log Files:

smb.conf:

[global]
  domain master = no
  local master = no
  preferred master = no
  winbind cache time = 300
  template shell = /bin/bash
  template homedir = /home/%U
  idmap domains = ALLDOMAINS
  idmap config ALLDOMAINS:backend  = ad
  idmap config ALLDOMAINS:default  = yes
  idmap config ALLDOMAINS:range= 500 - 3
  idmap config ALLDOMAINS:schema_mode  = rfc2307
  idmap alloc backend = tdb
  idmap alloc config:range   = 30001 - 35000
  winbind nss info = rfc2307 template
  winbind enum users = yes
  winbind enum groups = yes
  workgroup = XXX
  realm = XXX
  security = ads
  password server = *
  winbind refresh tickets = yes
  use kerberos keytab = yes
  client lanman auth = no
  client ntlmv2 auth = yes

/etc/pam.d/system-auth:
#%PAM-1.0

# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
authrequired  pam_env.so
authsufficientpam_unix.so nullok try_first_pass
authsufficientpam_winbind.so use_first_pass krb5_auth 
krb5_ccache_type=FILE debug

authrequisite pam_succeed_if.so uid = 500 quiet
authrequired  pam_deny.so

account required  pam_unix.so
account sufficientpam_succeed_if.so uid  500 quiet
account [default=bad success=ok user_unknown=ignore] pam_winbind.so
account required  pam_permit.so

passwordrequisite pam_cracklib.so try_first_pass retry=3
passwordsufficientpam_unix.so md5 shadow nullok try_first_pass 
use_authtok

passwordsufficientpam_winbind.so use_authtok
passwordrequired  pam_deny.so

session required  pam_limits.so
session sufficientpam_winbind.so krb5_auth krb5_ccache_type=FILE 
debug

session required  pam_unix.so

/var/log/secure: [The ticket expired during the night between these log 
events]


ug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): [pamh: 0x0061b220] ENTER: 
pam_sm_authenticate (flags: 0x)
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): getting password (0x0191)
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): pam_get_item returned a password
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): Verify user 'rking'
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): PAM config: krb5_ccache_type 'FILE'
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): enabling krb5 login flag
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): enabling request for a FILE krb5 
ccache
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): user 'rking' granted access
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): request returned KRB5CCNAME: 
FILE:/tmp/krb5cc_10001
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): Returned user was 'rking'
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:auth): [pamh: 0x0061b220] LEAVE: 
pam_sm_authenticate returning 0
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:account): user 'rking' OK
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:account): user 'rking' granted access
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:setcred): [pamh: 0x0061b220] ENTER: 
pam_sm_setcred (flags: 0x0008)
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:setcred): PAM_REINITIALIZE_CRED not 
implemented
Aug  9 16:39:44 pc15 gnome-screensaver-dialog: 
pam_winbind(gnome-screensaver:setcred): [pamh: 0x0061b220] LEAVE: 
pam_sm_setcred returning 0
Aug  9 19:21:37 pc15 gnome-screensaver-dialog: 
pam_unix(gnome-screensaver:auth): authentication failure; logname= 
uid=10001 euid=10001 tty=:0.0 

[Samba] the story of 2 samba, 1 ldap as passdb, and home sharing issue...quite urgent ^^

2007-08-14 Thread GreeG

Hi there,

I have 2 samba servers on with different users logged on...
I Have 1 ldap with all users account, each samba's server having 
personal ou (You know: user A from site 1 is know on samba from site 1 
in ou=1, user B from site 2 is know on samba from site 2 in ou=2, user C 
from site 1 is know on samba from site 1 in ou=1 etc.

And last, on each samba's server a home sharing like this:
[homes]
  comment = Your personal HomeFolder dude!
  path = /home/%U
  writeable = yes
  create mode = 0640
  directory mode = 0750
  browseable = yes

My issue is when user frome site 2 try to connect to share on site 1... 
He is seeing is home on samba server from site 1, buth this one have 
no existence on site 1 


Is there a solution that could make that when user from site 1 connect 
on site 1, he could see his Home, but when user from site 2 connect on 
site 1, he may not have to see a folderHome with his name?


Thanks everybody,

--
.:: Greg ::.
-
|http://daguilde.miniville.fr/  |
|http://gregory.esnaud.free.fr/ |
-

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Samba and Windows Domain Usernames

2007-08-14 Thread Martin Marcher
and for everyone else too :)

-- Forwarded message --
From: Martin Marcher [EMAIL PROTECTED]
Date: Aug 14, 2007 6:13 PM
Subject: Re: [Samba] Samba and Windows Domain Usernames
To: Marco Ferra [EMAIL PROTECTED]


Hello,

in man smb.conf

* write list
* read list (iirc)

and do read the substitution parts which i find quite practical a very
naive example would be

write list = %U

which only lets the user (but every user) write to the share with this option

report back if you need more pointers

On 8/13/07, Marco Ferra [EMAIL PROTECTED] wrote:
 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



--
Martin Marcher
[EMAIL PROTECTED]
http://www.mycorners.com
https://www.xing.com/profile/Martin_Marcher
http://www.linkedin.com/in/martinmarcher
http://www.studivz.net/profile.php?ids=9f83ea8c5996b8ec
http://www.amazon.de/gp/registry/wishlist/3KDAGCL2NKOIM/ref=reg_hu-wl_goto-registry/302-4432803-5146435?ie=UTF8sort=date-added


-- 
Martin Marcher
[EMAIL PROTECTED]
http://www.mycorners.com
https://www.xing.com/profile/Martin_Marcher
http://www.linkedin.com/in/martinmarcher
http://www.studivz.net/profile.php?ids=9f83ea8c5996b8ec
http://www.amazon.de/gp/registry/wishlist/3KDAGCL2NKOIM/ref=reg_hu-wl_goto-registry/302-4432803-5146435?ie=UTF8sort=date-added
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Samba and Windows Domain Usernames

2007-08-14 Thread Marco Ferra
Thanks a lot for the write list.  I think thats it.  I'll try it as
soon as possible.

On 8/14/07, Martin Marcher [EMAIL PROTECTED] wrote:
 and for everyone else too :)

 -- Forwarded message --
 From: Martin Marcher [EMAIL PROTECTED]
 Date: Aug 14, 2007 6:13 PM
 Subject: Re: [Samba] Samba and Windows Domain Usernames
 To: Marco Ferra [EMAIL PROTECTED]


 Hello,

 in man smb.conf

 * write list
 * read list (iirc)

 and do read the substitution parts which i find quite practical a very
 naive example would be

 write list = %U

 which only lets the user (but every user) write to the share with this option

 report back if you need more pointers

 On 8/13/07, Marco Ferra [EMAIL PROTECTED] wrote:
  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
 


 --
 Martin Marcher
 [EMAIL PROTECTED]
 http://www.mycorners.com
 https://www.xing.com/profile/Martin_Marcher
 http://www.linkedin.com/in/martinmarcher
 http://www.studivz.net/profile.php?ids=9f83ea8c5996b8ec
 http://www.amazon.de/gp/registry/wishlist/3KDAGCL2NKOIM/ref=reg_hu-wl_goto-registry/302-4432803-5146435?ie=UTF8sort=date-added


 --
 Martin Marcher
 [EMAIL PROTECTED]
 http://www.mycorners.com
 https://www.xing.com/profile/Martin_Marcher
 http://www.linkedin.com/in/martinmarcher
 http://www.studivz.net/profile.php?ids=9f83ea8c5996b8ec
 http://www.amazon.de/gp/registry/wishlist/3KDAGCL2NKOIM/ref=reg_hu-wl_goto-registry/302-4432803-5146435?ie=UTF8sort=date-added
 --
 To unsubscribe from this list go to the following URL and read the
 instructions:  https://lists.samba.org/mailman/listinfo/samba



-- 
Sinceros cumprimentos / Best regards
Marco Ferra
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[Samba] Bad Password Count Problem -- LDAP connection failed

2007-08-14 Thread Matt Anderson
Dear Help,

Initially, I thought that I had solved this problem, but it turns out that I
haven't.  I currently have Samba set up as a PDC with an eDirectory/LDAP
backend.  There are also a few Samba BDCs in play as well.

If a user enters the correct password, there are no issues and everything
authenticates fine.  If I turn off the PDC and force a user to authenticate
against a BDC with the wrong password, the Bad Password Count updates properly
and locks them out after the defined amount of attempts in pdbedit.  However, if
I turn off the BDCs and force the user to authenticate against the PDC with a
wrong password, it just hangs for awhile and never increments the Bad Password
Count. (This is all from the Ctrl+Alt+Delete Windows login box to get on to the
domain).

Also worth noting: If I log in locally to the same Windows machine as
Administrator and try and connect to a share on the PDC using the same user as
before with the wrong password, everything works as expected--the bad count gets
incremented, and there is no delay.

When I search the log files, the error that is causing this delay is a failed
LDAP connection attempt:
smbldap_open: cannot access LDAP when not root..
Which it tries 15 times before giving up.

The rest of the log file context is added below.  If anyone could provide any
advice or assistance, it would be greatly appreciated!

Thanks,
Matt

[2007/08/14 11:07:36, 3] auth/auth.c:check_ntlm_password(219)
  check_ntlm_password:  Checking password for unmapped user
[EMAIL PROTECTED] with the new password interface
[2007/08/14 11:07:36, 3] auth/auth.c:check_ntlm_password(222)
  check_ntlm_password:  mapped user is: [EMAIL PROTECTED]
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:push_sec_ctx(256)
  push_sec_ctx(65534, 65533) : sec_ctx_stack_ndx = 1
[2007/08/14 11:07:36, 3] smbd/uid.c:push_conn_ctx(393)
  push_conn_ctx(101) : conn_ctx_stack_ndx = 0
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:set_sec_ctx(288)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2007/08/14 11:07:36, 2] passdb/pdb_ldap.c:init_sam_from_ldap(640)
  init_sam_from_ldap: Entry found for user: testUser2
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:pop_sec_ctx(386)
  pop_sec_ctx (65534, 65533) - sec_ctx_stack_ndx = 0
[2007/08/14 11:07:36, 3] libsmb/ntlm_check.c:ntlm_password_check(207)
  ntlm_password_check: Interactive logon: NT password check failed for user
testUser2
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:push_sec_ctx(256)
  push_sec_ctx(65534, 65533) : sec_ctx_stack_ndx = 1
[2007/08/14 11:07:36, 3] smbd/uid.c:push_conn_ctx(393)
  push_conn_ctx(101) : conn_ctx_stack_ndx = 0
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:set_sec_ctx(288)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2007/08/14 11:07:36, 3] smbd/sec_ctx.c:pop_sec_ctx(386)
  pop_sec_ctx (65534, 65533) - sec_ctx_stack_ndx = 0
[2007/08/14 11:07:36, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:36, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 1 try!
[2007/08/14 11:07:37, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:37, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 2 try!
[2007/08/14 11:07:38, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:38, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 3 try!

...

[2007/08/14 11:07:50, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 15 try!
[2007/08/14 11:07:51, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:51, 3]
passdb/pdb_ldap.c:ldapsam_get_account_policy_from_ldap(3462)
  ldapsam_get_account_policy_from_ldap: Could not get account policy for
sambaDomainName=DOMAIN,o=Organization, error: Time limit exceeded ()
[2007/08/14 11:07:51, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:51, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 1 try!
[2007/08/14 11:07:52, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:07:52, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 2 try!

...

[2007/08/14 11:08:06, 1] lib/smbldap.c:another_ldap_try(1072)
  Connection to LDAP server failed for the 15 try!
[2007/08/14 11:08:07, 0] lib/smbldap.c:smbldap_open(943)
  smbldap_open: cannot access LDAP when not root..
[2007/08/14 11:08:07, 0] passdb/pdb_ldap.c:
ldapsam_set_account_policy_in_ldap(3400)
  ldapsam_set_account_policy_in_ldap: Could not set account policy for
sambaDomainName=DOMAIN,o=Organization, error: Timed out ()
[2007/08/14 11:08:07, 0] passdb/passdb.c:pdb_update_bad_password_count(2301)
  pdb_update_bad_password_count: pdb_get_account_policy failed.
[2007/08/14 11:08:07, 3] 

[Samba] ldap passwd sync only

2007-08-14 Thread Michal Bruncko
Hello

I have exactly the same trouble as described here:
http://www.nabble.com/ldap-passwd-sync-on-3.0.25a-tf4261008.html on
samba-3.0.25b-2.fc7.
When i set ldap passwd
sync to only and I change password on some ldap samba
user, password in attribute userPassword is never changed by samba daemon
(to update NT and LM password I use smbk5pwd overlay). If i set pwd
sync to On, both attributes (NTLM and
userPassword) was updated successfully. (I dont would use ldap passwd sync
to On, because then I could not create user in usrmgr.exe with not defined
password (access denied error))

Is that behaviour correct?

thanks

Michal Bruncko
-- 
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 ?

2007-08-14 Thread Doug VanLeuven

Wilkinson, Alex wrote:
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] 

Hi,
I don't use FreeBSD, but it looks like the make first applies FreeBSD 
patches against the main samba release.  What's failing is the patch 
against the very same file that you patched with group_fix_patch.txt.  
You need to look at smbd/sec_ctx.c.rej and see if what is failing is 
an attempt to apply the very same patch a second time.


You mentioned you were using 3.0.25a.  I believed this fix was applied 
to 3.0.25b and later.  But then again.


I've been having some issues with secondary groups in opensuse 10.2, 
samba 3.0.25b-1.1.72-1411-SUSE-SL10.2 , but haven't isolated what 
exactly is my issue.  On FC-5 samba 3.0.25c-SVN-build-23735 everything 
seems to be OK.


:I use:
   security = ADS
   winbind enum users = Yes
   winbind enum groups = Yes
   winbind nss info = sfu
   idmap domains = FOREST, SAMBA
   idmap config FOREST:readonly = yes
   idmap config FOREST:schema_mode = sfu
   idmap config FOREST:backend = ad
   idmap config SAMBA:readonly = yes
   idmap config SAMBA:backend = nss

The NIS plugin ought to work as well.

Regards, Doug


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[Samba] Performance Problem / failed to verify PAC server signature

2007-08-14 Thread Li, Ying (ESG)
Hello,

We are experiencing ADS lower performance on Samba-3.0.22 for HPUX. I
did Google search, and find out one message posted at
http://lists.samba.org/archive/samba/2005-November/114231.html at the
earlier time. 

From my observation, it seems there was a spin on
reply_spnego_negotiate()/ reply_spnego_kerberos() calls that invokes
register_vuid() to register uvid with different vuid# for a logon user
or a client. Finally, kill the intermediate vuid by
invalidate_vuid(vuid). This caused too many SMB calls on the wire(more
than hundreds of SMB calls, including
SMBsesssetup,SMBtcon,SMBtdis,SMBclose,SMBulogoff), but do nothing.

[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(251)
  ads_secrets_verify_ticket: enc type [18] failed to decrypt with error
Bad encryption type
[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(251)
  ads_secrets_verify_ticket: enc type [17] failed to decrypt with error
Bad encryption type
[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(251)
  ads_secrets_verify_ticket: enc type [16] failed to decrypt with error
Bad encryption type
[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(251)
  ads_secrets_verify_ticket: enc type [23] failed to decrypt with error
Bad encryption type
[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(251)
  ads_secrets_verify_ticket: enc type [1] failed to decrypt with error
Bad encryption type
[2007/08/14 12:01:03, 10]
libads/kerberos_verify.c:ads_secrets_verify_ticket(243)
  ads_secrets_verify_ticket: enc type [3] decrypted message !
..
 [2007/08/13 17:52:01, 3] libsmb/clikrb5.c:smb_krb5_verify_checksum(697)
smb_krb5_verify_checksum: krb5_c_verify_checksum() failed: Bad
encryption type
 [2007/08/13 17:52:01, 2] libads/authdata.c:check_pac_checksum(659)
check_pac_checksum: PAC Verification failed: Bad encryption type
(-1765328196)
 [2007/08/13 17:52:01, 0] libads/authdata.c:decode_pac_data(870)
decode_pac_data: failed to verify PAC server signature
 [2007/08/13 17:52:01, 3]
libads/kerberos_verify.c:ads_verify_ticket(416)
ads_verify_ticket: failed to decode PAC_DATA:
NT_STATUS_ACCESS_DENIED
..
[2007/08/14 12:01:05, 3] smbd/error.c:error_packet(142)
  error packet at smbd/sesssetup.c(318) cmd=115 (SMBsesssetupX)
NT_STATUS_LOGON_FAILURE
[2007/08/14 12:01:05, 3] smbd/sesssetup.c:reply_spnego_negotiate(558)
  reply_spnego_negotiate, invalidate_vuid

I'm wondering whether it's an abnormal behavior, or there is a specific
fix to improve performance. 
Could somebody look at this and help me out?

Thanks.
-Ying
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


svn commit: samba r24392 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 06:18:55 + (Tue, 14 Aug 2007)
New Revision: 24392

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24392

Log:
Minor simplifications
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-14 05:58:13 UTC (rev 
24391)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 06:18:55 UTC (rev 
24392)
@@ -2459,9 +2459,7 @@
DATA_BLOB header_blob;
 
_smb_setlen(header,nread);
-   header_blob.data = (uint8 *)header;
-   header_blob.length = 4;
-   header_blob.free = NULL;
+   header_blob = data_blob_const(header, 4);
 
if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp-fh-fd,
header_blob, startpos, nread) == -1) {
@@ -2594,7 +2592,7 @@
flush_write_cache(fsp, READRAW_FLUSH);
 
startpos = IVAL_TO_SMB_OFF_T(req-inbuf,smb_vwv1);
-   if(CVAL(req-inbuf,smb_wct) == 10) {
+   if(req-wct == 10) {
/*
 * This is a large offset (64 bit) read.
 */



svn commit: samba r24393 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 06:21:02 + (Tue, 14 Aug 2007)
New Revision: 24393

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24393

Log:
Convert call_nt_transact_set_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 06:18:55 UTC (rev 
24392)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 06:21:02 UTC (rev 
24393)
@@ -2983,10 +2983,15 @@
  Reply to set user quota
 /
 
-static int call_nt_transact_set_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_set_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)
 {
char *params = *ppparams;
char *pdata = *ppdata;
@@ -3002,7 +3007,8 @@
if (current_user.ut.uid != 0) {
DEBUG(1,(set_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;
}
 
/*
@@ -3011,19 +3017,22 @@
 
if (parameter_count  2) {
DEBUG(0,(TRANSACT_SET_USER_QUOTA: requires %d = 2 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;
}
 
if (data_count  40) {
DEBUG(0,(TRANSACT_SET_USER_QUOTA: requires %d = %d bytes 
data\n,data_count,40));
-   return ERROR_DOS(ERRDOS,ERRunknownlevel);   
+   reply_doserror(req, ERRDOS, ERRunknownlevel);
+   return;
}
 
/* offset to next quota record.
@@ -3036,7 +3045,8 @@
 
if (data_count  40+sid_len) {
DEBUG(0,(TRANSACT_SET_USER_QUOTA: requires %d = %lu bytes 
data\n,data_count,(unsigned long)40+sid_len));
-   return ERROR_DOS(ERRDOS,ERRunknownlevel);   
+   reply_doserror(req, ERRDOS, ERRunknownlevel);
+   return;
}
 
/* unknown 8 bytes in pdata 
@@ -3052,7 +3062,8 @@
((qt.usedspace != 0x)||
(IVAL(pdata,20)!=0x))) {
/* more than 32 bits? */
-   return ERROR_DOS(ERRDOS,ERRunknownlevel);
+   reply_doserror(req, ERRDOS, ERRunknownlevel);
+   return;
}
 #endif /* LARGE_SMB_OFF_T */
 
@@ -3065,7 +3076,8 @@
((qt.softlim != 0x)||
(IVAL(pdata,28)!=0x))) {
/* more than 32 bits? */
-   return ERROR_DOS(ERRDOS,ERRunknownlevel);
+   reply_doserror(req, ERRDOS, ERRunknownlevel);
+   return;
}
 #endif /* LARGE_SMB_OFF_T */
 
@@ -3078,7 +3090,8 @@
((qt.hardlim != 0x)||
(IVAL(pdata,36)!=0x))) {
/* more than 32 bits? */
-   return ERROR_DOS(ERRDOS,ERRunknownlevel);
+   reply_doserror(req, ERRDOS, ERRunknownlevel);
+   return;
}
 #endif /* LARGE_SMB_OFF_T */

@@ -3088,13 +3101,12 @@
/* 44 unknown bytes left... */
 
if (vfs_set_ntquota(fsp, SMB_USER_QUOTA_TYPE, sid, qt)!=0) {
-   return ERROR_DOS(ERRSRV,ERRerror);  
+   reply_doserror(req, ERRSRV, ERRerror);
+   return;
}
 
-   send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, param_len,
-   pdata, data_len);
-
-   return -1;
+  

Re: svn commit: samba r24375 - in branches/SAMBA_4_0/source/winbind: .

2007-08-14 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Kai,

 + /* We need the workgroup later, so copy it  */
 + state-workgroup = talloc_strdup(state,
 + state-domain-libnet_ctx-samr.name);

you should add a composite_nomem() here...

 + ctx = libnet_UserInfo_send(state-domain-libnet_ctx, state, user_info,
 + NULL);

metze
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGwU/7m70gjA5TCD8RAgq2AKCq946OkLJW3+xrvQ/ofTl8QTIFGQCfeFj9
dXoBeHWvktY8+ive4C6DTfs=
=bP+O
-END PGP SIGNATURE-


Re: svn commit: samba r24376 - in branches/SAMBA_4_0/source/winbind: .

2007-08-14 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Kai,

 +struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
 + struct wbsrv_service *service, uid_t uid)

s/uid_ uid/git_t gid/ :-)

 + /* 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;

s/uid/gid/ :-)



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGwVDmm70gjA5TCD8RApGdAJ9TmhiqZHFPb/jMN8SrK/Dk20aiUQCdFj1d
183bwRiO4UpIpPKWzSRVNCg=
=qcnK
-END PGP SIGNATURE-


svn commit: samba r24394 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 06:52:30 + (Tue, 14 Aug 2007)
New Revision: 24394

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24394

Log:
Convert call_nt_transact_rename 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 06:21:02 UTC (rev 
24393)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 06:52:30 UTC (rev 
24394)
@@ -2167,10 +2167,12 @@
  Reply to an NT transact rename command.
 /
 
-static int call_nt_transact_rename(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_rename(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;
pstring new_name;
@@ -2178,44 +2180,46 @@
BOOL replace_if_exists = False;
BOOL dest_has_wcard = False;
NTSTATUS status;
-   struct smb_request req;
 
-   init_smb_request(req, (uint8 *)inbuf);
-
 if(parameter_count  5) {
-   return ERROR_DOS(ERRDOS,ERRbadfunc);
+   reply_doserror(req, ERRDOS, ERRbadfunc);
+   return;
}
 
fsp = file_fsp(SVAL(params, 0));
replace_if_exists = (SVAL(params,2)  RENAME_REPLACE_IF_EXISTS) ? True 
: False;
-   CHECK_FSP(fsp, conn);
-   srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), new_name, params+4,
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   return;
+   }
+   srvstr_get_path_wcard(params, req-flags2, new_name, params+4,
  sizeof(new_name), parameter_count - 4,
  STR_TERMINATE, status, dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   return;
}
 
-   status = rename_internals(conn, req, fsp-fsp_name,
+   status = rename_internals(conn, req, fsp-fsp_name,
  new_name, 0, replace_if_exists, False, 
dest_has_wcard);
 
if (!NT_STATUS_IS_OK(status)) {
-   if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+   if (open_was_deferred(req-mid)) {
/* We have re-scheduled this call. */
-   return -1;
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   return;
}
 
/*
 * Rename was successful.
 */
-   send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, NULL, 0);
+   send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0);

DEBUG(3,(nt transact rename from = %s, to = %s succeeded.\n, 
 fsp-fsp_name, new_name));

-   return -1;
+   return;
 }
 
 /**
@@ -3190,28 +3194,13 @@
 
case NT_TRANSACT_RENAME:
{
-   char *inbuf, *outbuf;
-   int size, bufsize;
-
START_PROFILE(NT_transact_rename);
-
-   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_rename(
-   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_rename(
+   conn, req,
+   state-setup, state-setup_count,
+  

svn commit: samba r24395 - in branches/SAMBA_4_0/source/winbind: .

2007-08-14 Thread kai
Author: kai
Date: 2007-08-14 07:15:16 + (Tue, 14 Aug 2007)
New Revision: 24395

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24395

Log:
Add check if talloc_strdup worked.

Modified:
   branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c


Changeset:
Modified: branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c
===
--- branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c 2007-08-14 06:52:30 UTC 
(rev 24394)
+++ branches/SAMBA_4_0/source/winbind/wb_cmd_getpwuid.c 2007-08-14 07:15:16 UTC 
(rev 24395)
@@ -117,6 +117,7 @@
/* We need the workgroup later, so copy it  */
state-workgroup = talloc_strdup(state,
state-domain-libnet_ctx-samr.name);
+   if (composite_nomem(state-workgroup, state-ctx)) return;
 
ctx = libnet_UserInfo_send(state-domain-libnet_ctx, state, user_info,
NULL);



svn commit: samba r24396 - in branches/SAMBA_4_0/source/winbind: .

2007-08-14 Thread kai
Author: kai
Date: 2007-08-14 07:18:41 + (Tue, 14 Aug 2007)
New Revision: 24396

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24396

Log:
Fix a typo.

Thanks to metze ([EMAIL PROTECTED]) for catching this one.

Modified:
   branches/SAMBA_4_0/source/winbind/wb_gid2sid.c


Changeset:
Modified: branches/SAMBA_4_0/source/winbind/wb_gid2sid.c
===
--- branches/SAMBA_4_0/source/winbind/wb_gid2sid.c  2007-08-14 07:15:16 UTC 
(rev 24395)
+++ branches/SAMBA_4_0/source/winbind/wb_gid2sid.c  2007-08-14 07:18:41 UTC 
(rev 24396)
@@ -33,7 +33,7 @@
 };
 
 struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
-   struct wbsrv_service *service, uid_t uid)
+   struct wbsrv_service *service, gid_t gid)
 {
struct composite_context *result;
struct gid2sid_state *state;
@@ -51,8 +51,8 @@
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);
+* We cheat by just using the gid as RID with the domain SID.*/
+   state-sid = dom_sid_add_rid(result, service-primary_sid, gid);
if (composite_nomem(state-sid, state-ctx)) return result;
 
composite_done(state-ctx);



svn commit: samba r24397 - in branches/SAMBA_4_0/source/winbind: .

2007-08-14 Thread kai
Author: kai
Date: 2007-08-14 07:21:10 + (Tue, 14 Aug 2007)
New Revision: 24397

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24397

Log:
Bump debug level of sid2(u|g)id calls to 5.

Modified:
   branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.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-14 07:18:41 UTC 
(rev 24396)
+++ branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c   2007-08-14 07:21:10 UTC 
(rev 24397)
@@ -811,7 +811,7 @@
struct wbsrv_samba3_call);
NTSTATUS status;
 
-   DEBUG(1, (sid2uid_recv called\n));
+   DEBUG(5, (sid2uid_recv called\n));
 
status = wb_sid2uid_recv(ctx, s3call-response.data.uid);
 
@@ -827,7 +827,7 @@
s3call-wbconn-listen_socket-service;
struct dom_sid *sid;
 
-   DEBUG(1, (wbsrv_samba3_sid2gid called\n));
+   DEBUG(5, (wbsrv_samba3_sid2gid called\n));
 
sid = dom_sid_parse_talloc(s3call, s3call-request.data.sid);
NT_STATUS_HAVE_NO_MEMORY(sid);
@@ -849,7 +849,7 @@
struct wbsrv_samba3_call);
NTSTATUS status;
 
-   DEBUG(1, (sid2gid_recv called\n));
+   DEBUG(5, (sid2gid_recv called\n));
 
status = wb_sid2gid_recv(ctx, s3call-response.data.gid);
 



svn commit: samba r24398 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 07:39:11 + (Tue, 14 Aug 2007)
New Revision: 24398

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24398

Log:
Convert call_nt_transact_notify_change to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/notify.c
   branches/SAMBA_3_2/source/smbd/nttrans.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/notify.c
===
--- branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 07:21:10 UTC (rev 
24397)
+++ branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 07:39:11 UTC (rev 
24398)
@@ -24,7 +24,7 @@
 struct notify_change_request {
struct notify_change_request *prev, *next;
struct files_struct *fsp;   /* backpointer for cancel by mid */
-   char request_buf[smb_size];
+   uint8 request_buf[smb_size];
uint32 filter;
uint32 max_param;
struct notify_mid_map *mid_map;
@@ -128,14 +128,14 @@
  Setup the common parts of the return packet and send it.
 */
 
-static void change_notify_reply_packet(const char *request_buf,
+static void change_notify_reply_packet(const uint8 *request_buf,
   NTSTATUS error_code)
 {
-   const char *inbuf = request_buf;
+   const char *inbuf = (char *)request_buf;
char outbuf[smb_size+38];
 
memset(outbuf, '\0', sizeof(outbuf));
-   construct_reply_common(request_buf, outbuf);
+   construct_reply_common(inbuf, outbuf);
 
ERROR_NT(error_code);
 
@@ -151,7 +151,7 @@
failed.);
 }
 
-void change_notify_reply(const char *request_buf, uint32 max_param,
+void change_notify_reply(const uint8 *request_buf, uint32 max_param,
 struct notify_change_buf *notify_buf)
 {
char *outbuf = NULL;
@@ -183,9 +183,9 @@
goto done;
}
 
-   construct_reply_common(request_buf, outbuf);
+   construct_reply_common((char *)request_buf, outbuf);
 
-   if (send_nt_replies(request_buf, outbuf, buflen, NT_STATUS_OK, 
prs_data_p(ps),
+   if (send_nt_replies((char *)request_buf, outbuf, buflen, NT_STATUS_OK, 
prs_data_p(ps),
prs_offset(ps), NULL, 0) == -1) {
exit_server(change_notify_reply_packet: send_smb failed.);
}
@@ -238,7 +238,7 @@
return status;
 }
 
-NTSTATUS change_notify_add_request(const char *inbuf, uint32 max_param,
+NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param,
   uint32 filter, BOOL recursive,
   struct files_struct *fsp)
 {

Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===
--- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 07:21:10 UTC (rev 
24397)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 07:39:11 UTC (rev 
24398)
@@ -2071,15 +2071,15 @@
  don't allow a directory to be opened.
 /
 
-static int call_nt_transact_notify_change(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,
- uint32 max_param_count)
+static void call_nt_transact_notify_change(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 max_param_count)
 {
uint16 *setup = *ppsetup;
files_struct *fsp;
@@ -2088,7 +2088,8 @@
BOOL recursive;
 
if(setup_count  6) {
-   return ERROR_DOS(ERRDOS,ERRbadfunc);
+   reply_doserror(req, ERRDOS, ERRbadfunc);
+   return;
}
 
fsp = file_fsp(SVAL(setup,4));
@@ -2098,14 +2099,16 @@
DEBUG(3,(call_nt_transact_notify_change\n));
 
if(!fsp) {
-   return ERROR_DOS(ERRDOS,ERRbadfid);
+   reply_doserror(req, ERRDOS, ERRbadfid);
+   return;
}
 
{
  

svn commit: samba r24399 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 07:58:56 + (Tue, 14 Aug 2007)
New Revision: 24399

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24399

Log:
Change change_notify_reply to use send_nt_replies_new

Modified:
   branches/SAMBA_3_2/source/smbd/notify.c
   branches/SAMBA_3_2/source/smbd/nttrans.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/notify.c
===
--- branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 07:39:11 UTC (rev 
24398)
+++ branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 07:58:56 UTC (rev 
24399)
@@ -154,9 +154,8 @@
 void change_notify_reply(const uint8 *request_buf, uint32 max_param,
 struct notify_change_buf *notify_buf)
 {
-   char *outbuf = NULL;
prs_struct ps;
-   size_t buflen;
+   struct smb_request *req = NULL;
 
if (notify_buf-num_changes == -1) {
change_notify_reply_packet(request_buf, NT_STATUS_OK);
@@ -176,22 +175,18 @@
goto done;
}
 
-   buflen = smb_size+38+prs_offset(ps) + 4 /* padding */;
-
-   if (!(outbuf = SMB_MALLOC_ARRAY(char, buflen))) {
+   if (!(req = talloc(tmp_talloc_ctx(), struct smb_request))) {
change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY);
goto done;
}
 
-   construct_reply_common((char *)request_buf, outbuf);
+   init_smb_request(req, request_buf);
 
-   if (send_nt_replies((char *)request_buf, outbuf, buflen, NT_STATUS_OK, 
prs_data_p(ps),
-   prs_offset(ps), NULL, 0) == -1) {
-   exit_server(change_notify_reply_packet: send_smb failed.);
-   }
+   send_nt_replies_new(req, NT_STATUS_OK, prs_data_p(ps),
+   prs_offset(ps), NULL, 0);
 
  done:
-   SAFE_FREE(outbuf);
+   TALLOC_FREE(req);
prs_mem_free(ps);
 
TALLOC_FREE(notify_buf-changes);

Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===
--- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 07:39:11 UTC (rev 
24398)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 07:58:56 UTC (rev 
24399)
@@ -67,7 +67,7 @@
  HACK ! Always assumes smb_setup field is zero.
 /
 
-int send_nt_replies(const char *inbuf,
+static int send_nt_replies(const char *inbuf,
char *outbuf,
int bufsize,
NTSTATUS nt_error,



svn commit: samba r24400 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 08:23:54 + (Tue, 14 Aug 2007)
New Revision: 24400

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24400

Log:
Fix a valgrind bug

Modified:
   branches/SAMBA_3_2/source/smbd/notify.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/notify.c
===
--- branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 07:58:56 UTC (rev 
24399)
+++ branches/SAMBA_3_2/source/smbd/notify.c 2007-08-14 08:23:54 UTC (rev 
24400)
@@ -180,10 +180,12 @@
goto done;
}
 
+   smb_setlen(NULL, request_buf, smb_size);
+
init_smb_request(req, request_buf);
 
-   send_nt_replies_new(req, NT_STATUS_OK, prs_data_p(ps),
-   prs_offset(ps), NULL, 0);
+   send_nt_replies(req, NT_STATUS_OK, prs_data_p(ps),
+   prs_offset(ps), NULL, 0);
 
  done:
TALLOC_FREE(req);



svn commit: samba r24401 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 08:24:02 + (Tue, 14 Aug 2007)
New Revision: 24401

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24401

Log:
Push reply_prep_legacy into send_nt_replies

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 08:23:54 UTC (rev 
24400)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 08:24:02 UTC (rev 
24401)
@@ -67,14 +67,9 @@
  HACK ! Always assumes smb_setup field is zero.
 /
 
-static int send_nt_replies(const char *inbuf,
-   char *outbuf,
-   int bufsize,
-   NTSTATUS nt_error,
-   char *params,
-   int paramsize,
-   char *pdata,
-   int datasize)
+void send_nt_replies(struct smb_request *req, NTSTATUS nt_error,
+char *params, int paramsize,
+char *pdata, int datasize)
 {
int data_to_send = datasize;
int params_to_send = paramsize;
@@ -90,6 +85,14 @@
 * transNT replies.
 */
 
+   char *inbuf, *outbuf;
+   int length, bufsize;
+
+   if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) {
+   reply_nterror(req, NT_STATUS_NO_MEMORY);
+   return;
+   }
+
set_message(inbuf,outbuf,18,0,True);
 
if (NT_STATUS_V(nt_error)) {
@@ -106,7 +109,8 @@
if (!send_smb(smbd_server_fd(),outbuf)) {
exit_server_cleanly(send_nt_replies: send_smb 
failed.);
}
-   return 0;
+   TALLOC_FREE(req-outbuf);
+   return;
}
 
/*
@@ -255,31 +259,12 @@
if(params_to_send  0 || data_to_send  0) {
DEBUG(0,(send_nt_replies failed sanity check pts = %d, 
dts = %d\n!!!,
params_to_send, data_to_send));
-   return -1;
+   TALLOC_FREE(req-outbuf);
+   return;
}
} 
-
-   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 ?
 /
@@ -1138,7 +1123,7 @@
DEBUG(5,(do_nt_transact_create_pipe: open name = %s\n, fname));

/* Send the required number of replies */
-   send_nt_replies_new(req, NT_STATUS_OK, params, param_len, *ppdata, 0);
+   send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0);

return;
 }
@@ -1789,7 +1774,7 @@
DEBUG(5,(call_nt_transact_create: open name = %s\n, fname));
 
/* Send the required number of replies */
-   send_nt_replies_new(req, NT_STATUS_OK, params, param_len, *ppdata, 0);
+   send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0);
 
return;
 }
@@ -2218,7 +2203,7 @@
/*
 * Rename was successful.
 */
-   send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+   send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);

DEBUG(3,(nt transact rename from = %s, to = %s succeeded.\n, 
 fsp-fsp_name, new_name));
@@ -2316,8 +2301,8 @@
 
if(max_data_count  sd_size) {
 
-   send_nt_replies_new(req, NT_STATUS_BUFFER_TOO_SMALL,
-   params, 4, *ppdata, 0);
+   send_nt_replies(req, NT_STATUS_BUFFER_TOO_SMALL,
+   params, 4, *ppdata, 0);
talloc_destroy(mem_ctx);
return;
}
@@ -2367,8 +2352,7 @@
 
talloc_destroy(mem_ctx);
 
-   send_nt_replies_new(req, NT_STATUS_OK, params, 4, data,
-   (int)sd_size);
+   send_nt_replies(req, NT_STATUS_OK, params, 4, data, (int)sd_size);
return;
 }
 
@@ -2423,7 +2407,7 @@
 
   done:
 
-   send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+   send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);
return;
 }

@@ -2472,7 +2456,7 @@
   

svn commit: samba r24402 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 08:29:36 + (Tue, 14 Aug 2007)
New Revision: 24402

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24402

Log:
Fix a 64-bit warning
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-14 08:24:02 UTC (rev 
24401)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 08:29:36 UTC (rev 
24402)
@@ -2501,7 +2501,7 @@
outbuf = TALLOC_ARRAY(NULL, char, nread+4);
if (!outbuf) {
DEBUG(0,(send_file_readbraw: TALLOC_ARRAY failed for size 
%u.\n,
-   nread+4));
+   (unsigned)(nread+4)));
reply_readbraw_error();
return;
}



svn commit: samba r24403 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 08:44:00 + (Tue, 14 Aug 2007)
New Revision: 24403

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24403

Log:
Remove reply_prep_legacy from send_nttrans_replies
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 08:29:36 UTC (rev 
24402)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 08:44:00 UTC (rev 
24403)
@@ -80,36 +80,14 @@
int alignment_offset = 3;
int data_alignment_offset = 0;
 
-   /*
-* Initially set the wcnt area to be 18 - this is true for all
-* transNT replies.
-*/
-
-   char *inbuf, *outbuf;
-   int length, bufsize;
-
-   if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) {
-   reply_nterror(req, NT_STATUS_NO_MEMORY);
-   return;
-   }
-
-   set_message(inbuf,outbuf,18,0,True);
-
-   if (NT_STATUS_V(nt_error)) {
-   ERROR_NT(nt_error);
-   }
-
/* 
 * If there genuinely are no parameters or data to send just send
 * the empty packet.
 */
 
if(params_to_send == 0  data_to_send == 0) {
-   show_msg(outbuf);
-   if (!send_smb(smbd_server_fd(),outbuf)) {
-   exit_server_cleanly(send_nt_replies: send_smb 
failed.);
-   }
-   TALLOC_FREE(req-outbuf);
+   reply_outbuf(req, 18, 0);
+   show_msg((char *)req-outbuf);
return;
}
 
@@ -130,9 +108,10 @@
 * NT needs this to work correctly.
 */
 
-   useable_space = bufsize - ((smb_buf(outbuf)+
-   alignment_offset+data_alignment_offset) -
-   outbuf);
+   useable_space = max_send - (smb_size
+   + 2 * 18 /* wct */
+   + alignment_offset
+   + data_alignment_offset);
 
/*
 * useable_space can never be more than max_send minus the
@@ -158,14 +137,14 @@
 
total_sent_thistime = MIN(total_sent_thistime, useable_space);
 
-   set_message(inbuf,outbuf, 18, total_sent_thistime, True);
+   reply_outbuf(req, 18, total_sent_thistime);
 
/*
 * Set total params and data to be sent.
 */
 
-   SIVAL(outbuf,smb_ntr_TotalParameterCount,paramsize);
-   SIVAL(outbuf,smb_ntr_TotalDataCount,datasize);
+   SIVAL(req-outbuf,smb_ntr_TotalParameterCount,paramsize);
+   SIVAL(req-outbuf,smb_ntr_TotalDataCount,datasize);
 
/* 
 * Calculate how many parameters and data we can fit into
@@ -176,11 +155,12 @@
data_sent_thistime = useable_space - params_sent_thistime;
data_sent_thistime = MIN(data_sent_thistime,data_to_send);
 
-   SIVAL(outbuf,smb_ntr_ParameterCount,params_sent_thistime);
+   SIVAL(req-outbuf, smb_ntr_ParameterCount,
+ params_sent_thistime);
 
if(params_sent_thistime == 0) {
-   SIVAL(outbuf,smb_ntr_ParameterOffset,0);
-   SIVAL(outbuf,smb_ntr_ParameterDisplacement,0);
+   SIVAL(req-outbuf,smb_ntr_ParameterOffset,0);
+   SIVAL(req-outbuf,smb_ntr_ParameterDisplacement,0);
} else {
/*
 * smb_ntr_ParameterOffset is the offset from the start 
of the SMB header to the
@@ -189,33 +169,37 @@
 * them from the calculation.
 */
 
-   SIVAL(outbuf,smb_ntr_ParameterOffset,
-   ((smb_buf(outbuf)+alignment_offset) - 
smb_base(outbuf)));
+   SIVAL(req-outbuf,smb_ntr_ParameterOffset,
+ ((smb_buf(req-outbuf)+alignment_offset)
+  - smb_base(req-outbuf)));
/* 
 * Absolute displacement of param bytes sent in this 
packet.
 */
 
-   SIVAL(outbuf,smb_ntr_ParameterDisplacement,pp - params);
+   SIVAL(req-outbuf, smb_ntr_ParameterDisplacement,
+ pp - params);
}
 
/*
 * Deal with the data portion.
 */
 
-   SIVAL(outbuf,smb_ntr_DataCount, data_sent_thistime);
+   SIVAL(req-outbuf, smb_ntr_DataCount, data_sent_thistime);
 
if(data_sent_thistime == 0) {
-   SIVAL(outbuf,smb_ntr_DataOffset,0);
-   

svn commit: samba r24404 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 10:06:33 + (Tue, 14 Aug 2007)
New Revision: 24404

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24404

Log:
Remove get_OutBuffer usage from blocking.c

Modified:
   branches/SAMBA_3_2/source/smbd/blocking.c
   branches/SAMBA_3_2/source/smbd/process.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/blocking.c
===
--- branches/SAMBA_3_2/source/smbd/blocking.c   2007-08-14 08:44:00 UTC (rev 
24403)
+++ branches/SAMBA_3_2/source/smbd/blocking.c   2007-08-14 10:06:33 UTC (rev 
24404)
@@ -250,34 +250,20 @@
 }
 
 /
- Return a smd with a given size.
-*/
-
-static void send_blocking_reply(char *outbuf, int outsize, const char *inbuf)
-{
-   if(outsize  4) {
-   smb_setlen(inbuf, outbuf,outsize - 4);
-   }
-
-   if (!send_smb(smbd_server_fd(),outbuf)) {
-   exit_server_cleanly(send_blocking_reply: send_smb failed.);
-   }
-}
-
-/
  Return a lockingX success SMB.
 */
 
 static void reply_lockingX_success(blocking_lock_record *blr)
 {
-   char *outbuf = get_OutBuffer();
-   int bufsize = BUFFER_SIZE;
-   char *inbuf = blr-inbuf;
-   int outsize = 0;
+   struct smb_request *req;
 
-   construct_reply_common(inbuf, outbuf);
-   set_message(inbuf,outbuf,2,0,True);
+   if (!(req = talloc(tmp_talloc_ctx(), struct smb_request))) {
+   smb_panic(Could not allocate smb_request);
+   }
 
+   init_smb_request(req, (uint8 *)blr-inbuf);
+   reply_outbuf(req, 2, 0);
+
/*
 * As this message is a lockingX call we must handle
 * any following chained message correctly.
@@ -286,11 +272,11 @@
 * that here and must set up the chain info manually.
 */
 
-   outsize = chain_reply(inbuf,outbuf,blr-length,bufsize);
+   chain_reply_new(req);
 
-   outsize += chain_size;
-
-   send_blocking_reply(outbuf,outsize,inbuf);
+   if (!send_smb(smbd_server_fd(),(char *)req-outbuf)) {
+   exit_server_cleanly(send_blocking_reply: send_smb failed.);
+   }
 }
 
 /
@@ -299,8 +285,9 @@
 
 static void generic_blocking_lock_error(blocking_lock_record *blr, NTSTATUS 
status)
 {
-   char *outbuf = get_OutBuffer();
+   char outbuf[smb_size];
char *inbuf = blr-inbuf;
+
construct_reply_common(inbuf, outbuf);
 
/* whenever a timeout is given w2k maps LOCK_NOT_GRANTED to
@@ -395,7 +382,7 @@
case SMBtrans2:
case SMBtranss2:
{
-   char *outbuf = get_OutBuffer();
+   char outbuf[smb_size];
char *inbuf = blr-inbuf;
construct_reply_common(inbuf, outbuf);
/* construct_reply_common has done us the favor to 
pre-fill the

Modified: branches/SAMBA_3_2/source/smbd/process.c
===
--- branches/SAMBA_3_2/source/smbd/process.c2007-08-14 08:44:00 UTC (rev 
24403)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 10:06:33 UTC (rev 
24404)
@@ -1743,11 +1743,6 @@
return InBuffer;
 }
 
-char *get_OutBuffer(void)
-{
-   return OutBuffer;
-}
-
 /
  Allocate a new InBuffer. Returns the new and old ones.
 /



svn commit: samba r24405 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 10:27:27 + (Tue, 14 Aug 2007)
New Revision: 24405

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24405

Log:
Check wct in reply_lockingX
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-14 10:06:33 UTC (rev 
24404)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 10:27:27 UTC (rev 
24405)
@@ -5773,23 +5773,34 @@
 int reply_lockingX(connection_struct *conn, char *inbuf, char *outbuf,
   int length, int bufsize)
 {
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv2));
-   unsigned char locktype = CVAL(inbuf,smb_vwv3);
-   unsigned char oplocklevel = CVAL(inbuf,smb_vwv3+1);
-   uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
-   uint16 num_locks = SVAL(inbuf,smb_vwv7);
+   files_struct *fsp;
+   unsigned char locktype;
+   unsigned char oplocklevel;
+   uint16 num_ulocks;
+   uint16 num_locks;
SMB_BIG_UINT count = 0, offset = 0;
uint32 lock_pid;
-   int32 lock_timeout = IVAL(inbuf,smb_vwv4);
+   int32 lock_timeout;
int i;
char *data;
-   BOOL large_file_format =
-   (locktype  LOCKING_ANDX_LARGE_FILES)?True:False;
+   BOOL large_file_format;
BOOL err;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
START_PROFILE(SMBlockingX);
+
+   if (CVAL(inbuf, smb_wct)  8) {
+   return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+   }

+   fsp = file_fsp(SVAL(inbuf,smb_vwv2));
+   locktype = CVAL(inbuf,smb_vwv3);
+   oplocklevel = CVAL(inbuf,smb_vwv3+1);
+   num_ulocks = SVAL(inbuf,smb_vwv6);
+   num_locks = SVAL(inbuf,smb_vwv7);
+   lock_timeout = IVAL(inbuf,smb_vwv4);
+   large_file_format = (locktype  LOCKING_ANDX_LARGE_FILES)?True:False;
+
CHECK_FSP(fsp,conn);

data = smb_buf(inbuf);



svn commit: samba r24406 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 10:47:47 + (Tue, 14 Aug 2007)
New Revision: 24406

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24406

Log:
Push reply_prep_legacy into reply_lockingX
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-14 10:27:27 UTC (rev 
24405)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 10:47:47 UTC (rev 
24406)
@@ -726,7 +726,7 @@
 /* 0x21 */ { NULL, NULL, NULL, 0 },
 /* 0x22 */ { SMBsetattrE,reply_setattrE,NULL,AS_USER | NEED_WRITE },
 /* 0x23 */ { SMBgetattrE,reply_getattrE,NULL,AS_USER },
-/* 0x24 */ { SMBlockingX,reply_lockingX,NULL,AS_USER },
+/* 0x24 */ { SMBlockingX,NULL,reply_lockingX,AS_USER },
 /* 0x25 */ { SMBtrans,NULL,reply_trans,AS_USER | CAN_IPC },
 /* 0x26 */ { SMBtranss,NULL,reply_transs,AS_USER | CAN_IPC},
 /* 0x27 */ { SMBioctl,reply_ioctl,NULL,0},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 10:27:27 UTC (rev 
24405)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 10:47:47 UTC (rev 
24406)
@@ -5770,8 +5770,7 @@
  Reply to a lockingX request.
 /
 
-int reply_lockingX(connection_struct *conn, char *inbuf, char *outbuf,
-  int length, int bufsize)
+void reply_lockingX(connection_struct *conn, struct smb_request *req)
 {
files_struct *fsp;
unsigned char locktype;
@@ -5787,10 +5786,21 @@
BOOL err;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
+   char *inbuf, *outbuf;
+   int length, bufsize;
+
START_PROFILE(SMBlockingX);
 
+   if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) {
+   reply_nterror(req, NT_STATUS_NO_MEMORY);
+   END_PROFILE(SMBlockingX);
+   return;
+   }
+
if (CVAL(inbuf, smb_wct)  8) {
-   return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBlockingX);
+   return;
}

fsp = file_fsp(SVAL(inbuf,smb_vwv2));
@@ -5801,7 +5811,9 @@
lock_timeout = IVAL(inbuf,smb_vwv4);
large_file_format = (locktype  LOCKING_ANDX_LARGE_FILES)?True:False;
 
-   CHECK_FSP(fsp,conn);
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   return;
+   }

data = smb_buf(inbuf);
 
@@ -5809,7 +5821,9 @@
/* we don't support these - and CANCEL_LOCK makes w2k
   and XP reboot so I don't really want to be
   compatible! (tridge) */
-   return ERROR_NT(NT_STATUS_DOS(ERRDOS, ERRnoatomiclocks));
+   reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRnoatomiclocks));
+   END_PROFILE(SMBlockingX);
+   return;
}

/* Check if this is an oplock break on a file
@@ -5846,10 +5860,12 @@
 * send a reply */
if (num_locks == 0  num_ulocks == 0) {
END_PROFILE(SMBlockingX);
-   return -1;
+   reply_post_legacy(req, -1);
+   return;
} else {
END_PROFILE(SMBlockingX);
-   return ERROR_DOS(ERRDOS,ERRlock);
+   reply_doserror(req, ERRDOS, ERRlock);
+   return;
}
}
 
@@ -5879,7 +5895,8 @@
 break is a chained %d request !\n,
 (unsigned int)CVAL(inbuf,smb_vwv0) ));
END_PROFILE(SMBlockingX);
-   return -1;
+   reply_post_legacy(req, -1);
+   return;
}
}
 
@@ -5902,7 +5919,8 @@
 */
if(err) {
END_PROFILE(SMBlockingX);
-   return ERROR_DOS(ERRDOS,ERRnoaccess);
+   reply_doserror(req, ERRDOS, ERRnoaccess);
+   return;
}
 
DEBUG(10,(reply_lockingX: unlock start=%.0f, len=%.0f for 
@@ -5918,7 +5936,8 @@
 
if (NT_STATUS_V(status)) {
END_PROFILE(SMBlockingX);
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   return;
}
}
 
@@ -5946,7 +5965,8 @@
 */
if(err) {
   

svn commit: samba r24407 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl: .

2007-08-14 Thread metze
Author: metze
Date: 2007-08-14 11:50:45 + (Tue, 14 Aug 2007)
New Revision: 24407

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24407

Log:
$element-{ARRAY_LEN} doesn't exist...

and a few lines above we use $element-{ORIGINAL}-{ARRAY_LEN}
I assume it was just forgotten in the update.

metze
Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm 2007-08-14 
10:47:47 UTC (rev 24406)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm 2007-08-14 
11:50:45 UTC (rev 24407)
@@ -62,7 +62,7 @@
$ret.=* foreach (1..$numstar);
}
$ret.=$element-{NAME};
-   foreach (@{$element-{ARRAY_LEN}}) {
+   foreach (@{$element-{ORIGINAL}-{ARRAY_LEN}}) {
next unless (is_constant($_) and not has_property($element, 
charset));
$ret.=[$_];
}



svn commit: samba r24408 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 13:38:14 + (Tue, 14 Aug 2007)
New Revision: 24408

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24408

Log:
Remove reply_prep_legacy from reply_lockingX
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-14 11:50:45 UTC (rev 
24407)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 13:38:14 UTC (rev 
24408)
@@ -5786,36 +5786,28 @@
BOOL err;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
-   char *inbuf, *outbuf;
-   int length, bufsize;
-
START_PROFILE(SMBlockingX);
 
-   if (!reply_prep_legacy(req, inbuf, outbuf, length, bufsize)) {
-   reply_nterror(req, NT_STATUS_NO_MEMORY);
-   END_PROFILE(SMBlockingX);
-   return;
-   }
-
-   if (CVAL(inbuf, smb_wct)  8) {
+   if (req-wct  8) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBlockingX);
return;
}

-   fsp = file_fsp(SVAL(inbuf,smb_vwv2));
-   locktype = CVAL(inbuf,smb_vwv3);
-   oplocklevel = CVAL(inbuf,smb_vwv3+1);
-   num_ulocks = SVAL(inbuf,smb_vwv6);
-   num_locks = SVAL(inbuf,smb_vwv7);
-   lock_timeout = IVAL(inbuf,smb_vwv4);
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv2));
+   locktype = CVAL(req-inbuf,smb_vwv3);
+   oplocklevel = CVAL(req-inbuf,smb_vwv3+1);
+   num_ulocks = SVAL(req-inbuf,smb_vwv6);
+   num_locks = SVAL(req-inbuf,smb_vwv7);
+   lock_timeout = IVAL(req-inbuf,smb_vwv4);
large_file_format = (locktype  LOCKING_ANDX_LARGE_FILES)?True:False;
 
if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBlockingX);
return;
}

-   data = smb_buf(inbuf);
+   data = smb_buf(req-inbuf);
 
if (locktype  LOCKING_ANDX_CHANGE_LOCKTYPE) {
/* we don't support these - and CANCEL_LOCK makes w2k
@@ -5890,12 +5882,12 @@
if (num_locks == 0  num_ulocks == 0) {
/* Sanity check - ensure a pure oplock break is not a
   chained request. */
-   if(CVAL(inbuf,smb_vwv0) != 0xff)
+   if(CVAL(req-inbuf,smb_vwv0) != 0xff)
DEBUG(0,(reply_lockingX: Error : pure oplock 
 break is a chained %d request !\n,
-(unsigned int)CVAL(inbuf,smb_vwv0) ));
+(unsigned int)CVAL(req-inbuf,
+   smb_vwv0) ));
END_PROFILE(SMBlockingX);
-   reply_post_legacy(req, -1);
return;
}
}
@@ -5906,6 +5898,13 @@
 */

release_level_2_oplocks_on_change(fsp);
+
+   if (smb_buflen(req-inbuf) 
+   (num_ulocks + num_locks) * (large_file_format ? 20 : 10)) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBlockingX);
+   return;
+   }

/* Data now points at the beginning of the list
   of smb_unlkrng structs */
@@ -6047,7 +6046,8 @@
 * onto the blocking lock queue.
 */
if(push_blocking_lock_request(br_lck,
-   inbuf, length,
+   (char *)req-inbuf,
+   smb_len(req-inbuf)+4,
fsp,
lock_timeout,
i,
@@ -6113,9 +6113,7 @@
return;
}
 
-   set_message(inbuf,outbuf,2,0,True);
-
-   reply_post_legacy(req, smb_len(outbuf)+4);
+   reply_outbuf(req, 2, 0);

DEBUG(3, (lockingX fnum=%d type=%d num_locks=%d num_ulocks=%d\n,
  fsp-fnum, (unsigned int)locktype, num_locks, num_ulocks));



svn commit: samba r24409 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 13:57:36 + (Tue, 14 Aug 2007)
New Revision: 24409

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24409

Log:
Check wct in reply_open
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-14 13:38:14 UTC (rev 
24408)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 13:57:36 UTC (rev 
24409)
@@ -1402,9 +1402,9 @@
int info;
SMB_STRUCT_STAT sbuf;
files_struct *fsp;
-   int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
+   int oplock_request;
int deny_mode;
-   uint32 dos_attr = SVAL(inbuf,smb_vwv1);
+   uint32 dos_attr;
uint32 access_mask;
uint32 share_mode;
uint32 create_disposition;
@@ -1415,8 +1415,14 @@
START_PROFILE(SMBopen);
 
init_smb_request(req, (uint8 *)inbuf);
+
+   if (req.wct  2) {
+   return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+   }
  
+   oplock_request = CORE_OPLOCK_REQUEST(inbuf);
deny_mode = SVAL(inbuf,smb_vwv0);
+   dos_attr = SVAL(inbuf,smb_vwv1);
 
srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
sizeof(fname), 0, STR_TERMINATE, status);



svn commit: samba r24410 - in branches/SAMBA_3_2/source: libsmb rpc_parse

2007-08-14 Thread derrell
Author: derrell
Date: 2007-08-14 14:27:42 + (Tue, 14 Aug 2007)
New Revision: 24410

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24410

Log:
- I got tricked by function naming.  Contrary to what seemed obvious to me,
  prs_mem_free() is not the function to be called to free memory allocated by
  prs_alloc_mem().  I've added a comment so others may not get bitten too.

- Remove incorrect memory free calls added yesterday to replace SAFE_FREE.
  The memory is actually now on a talloc context, so gets freed by the caller
  when that context is freed.  We don't need to free it iternally.

Derrell

Modified:
   branches/SAMBA_3_2/source/libsmb/libsmbclient.c
   branches/SAMBA_3_2/source/rpc_parse/parse_prs.c


Changeset:
Modified: branches/SAMBA_3_2/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_2/source/libsmb/libsmbclient.c 2007-08-14 13:57:36 UTC 
(rev 24409)
+++ branches/SAMBA_3_2/source/libsmb/libsmbclient.c 2007-08-14 14:27:42 UTC 
(rev 24410)
@@ -5142,8 +5142,6 @@
switch (mode) {
case SMBC_XATTR_MODE_REMOVE_ALL:
 old-dacl-num_aces = 0;
-prs_mem_free(old-dacl-aces);
-prs_mem_free(old-dacl);
 old-dacl = NULL;
 dacl = old-dacl;
 break;
@@ -5162,8 +5160,6 @@
}
old-dacl-num_aces--;
if (old-dacl-num_aces == 0) {
-prs_mem_free(old-dacl-aces);
-prs_mem_free(old-dacl);
old-dacl = NULL;
}
found = True;

Modified: branches/SAMBA_3_2/source/rpc_parse/parse_prs.c
===
--- branches/SAMBA_3_2/source/rpc_parse/parse_prs.c 2007-08-14 13:57:36 UTC 
(rev 24409)
+++ branches/SAMBA_3_2/source/rpc_parse/parse_prs.c 2007-08-14 14:27:42 UTC 
(rev 24410)
@@ -122,6 +122,10 @@
 
 /***
  Delete the memory in a parse structure - if we own it.
+
+ NOTE: Contrary to the somewhat confusing naming, this function is not
+   intended for freeing memory allocated by prs_alloc_mem().  That memory
+   is attached to the talloc context given by ps-mem_ctx.
  /
 
 void prs_mem_free(prs_struct *ps)



svn commit: samba r24411 - in branches/SAMBA_3_2_0/source: libsmb rpc_parse

2007-08-14 Thread derrell
Author: derrell
Date: 2007-08-14 14:28:04 + (Tue, 14 Aug 2007)
New Revision: 24411

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24411

Log:
- I got tricked by function naming.  Contrary to what seemed obvious to me,
  prs_mem_free() is not the function to be called to free memory allocated by
  prs_alloc_mem().  I've added a comment so others may not get bitten too.

- Remove incorrect memory free calls added yesterday to replace SAFE_FREE.
  The memory is actually now on a talloc context, so gets freed by the caller
  when that context is freed.  We don't need to free it iternally.

Derrell

Modified:
   branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c
   branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c


Changeset:
Modified: branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c   2007-08-14 14:27:42 UTC 
(rev 24410)
+++ branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c   2007-08-14 14:28:04 UTC 
(rev 24411)
@@ -5152,8 +5152,6 @@
switch (mode) {
case SMBC_XATTR_MODE_REMOVE_ALL:
 old-dacl-num_aces = 0;
-prs_mem_free(old-dacl-aces);
-prs_mem_free(old-dacl);
 old-dacl = NULL;
 dacl = old-dacl;
 break;
@@ -5172,8 +5170,6 @@
}
old-dacl-num_aces--;
if (old-dacl-num_aces == 0) {
-prs_mem_free(old-dacl-aces);
-prs_mem_free(old-dacl);
old-dacl = NULL;
}
found = True;

Modified: branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c
===
--- branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c   2007-08-14 14:27:42 UTC 
(rev 24410)
+++ branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c   2007-08-14 14:28:04 UTC 
(rev 24411)
@@ -122,6 +122,10 @@
 
 /***
  Delete the memory in a parse structure - if we own it.
+
+ NOTE: Contrary to the somewhat confusing naming, this function is not
+   intended for freeing memory allocated by prs_alloc_mem().  That memory
+   is attached to the talloc context given by ps-mem_ctx.
  /
 
 void prs_mem_free(prs_struct *ps)



svn commit: samba r24412 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 14:31:55 + (Tue, 14 Aug 2007)
New Revision: 24412

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24412

Log:
Convert reply_open to the new API
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-14 14:28:04 UTC (rev 
24411)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 14:31:55 UTC (rev 
24412)
@@ -692,7 +692,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 },
+/* 0x02 */ { SMBopen,NULL,reply_open,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},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 14:28:04 UTC (rev 
24411)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 14:31:55 UTC (rev 
24412)
@@ -1392,10 +1392,9 @@
  Reply to an open.
 /
 
-int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_open(connection_struct *conn, struct smb_request *req)
 {
pstring fname;
-   int outsize = 0;
uint32 fattr=0;
SMB_OFF_T size = 0;
time_t mtime=0;
@@ -1410,55 +1409,64 @@
uint32 create_disposition;
uint32 create_options = 0;
NTSTATUS status;
-   struct smb_request req;
 
START_PROFILE(SMBopen);
 
-   init_smb_request(req, (uint8 *)inbuf);
-
-   if (req.wct  2) {
-   return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+   if (req-wct  2) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBopen);
+   return;
}
  
-   oplock_request = CORE_OPLOCK_REQUEST(inbuf);
-   deny_mode = SVAL(inbuf,smb_vwv0);
-   dos_attr = SVAL(inbuf,smb_vwv1);
+   oplock_request = CORE_OPLOCK_REQUEST(req-inbuf);
+   deny_mode = SVAL(req-inbuf,smb_vwv0);
+   dos_attr = SVAL(req-inbuf,smb_vwv1);
 
-   srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
-   sizeof(fname), 0, STR_TERMINATE, status);
+   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(SMBopen);
-   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(SMBopen);
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);
+   END_PROFILE(SMBopen);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBopen);
+   return;
}
 
status = unix_convert(conn, fname, False, NULL, sbuf);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBopen);
-   return ERROR_NT(status);
+   return;
}
 
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBopen);
-   return ERROR_NT(status);
+   return;
}
 
if (!map_open_params_to_ntcreate(fname, deny_mode, 
OPENX_FILE_EXISTS_OPEN,
access_mask, share_mode, create_disposition, 
create_options)) {
+   reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
END_PROFILE(SMBopen);
-   return ERROR_NT(NT_STATUS_DOS(ERRDOS, ERRbadaccess));
+   return;
}
 
-   status = open_file_ntcreate(conn, req, fname, sbuf,
+   status = open_file_ntcreate(conn, req, fname, sbuf,
access_mask,
share_mode,
create_disposition,
@@ -1468,12 

svn commit: samba-docs r1150 - in trunk/smbdotconf/vfs: .

2007-08-14 Thread kseeger
Author: kseeger
Date: 2007-08-14 14:41:48 + (Tue, 14 Aug 2007)
New Revision: 1150

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-docsrev=1150

Log:
Fix example for msdfs proxy.
Neither smbclient nor WinXP can connect if two '\' are used.
Maybe fixing the server side would be the better choice...

Karolin
Modified:
   trunk/smbdotconf/vfs/msdfsproxy.xml


Changeset:
Modified: trunk/smbdotconf/vfs/msdfsproxy.xml
===
--- trunk/smbdotconf/vfs/msdfsproxy.xml 2007-08-13 16:00:27 UTC (rev 1149)
+++ trunk/smbdotconf/vfs/msdfsproxy.xml 2007-08-14 14:41:48 UTC (rev 1150)
@@ -14,5 +14,5 @@
options to find out how to set up a Dfs root share./para
 /description
 
-value type=example\\otherserver\someshare/value
+value type=example\otherserver\someshare/value
 /samba:parameter



svn commit: samba r24413 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/libgpo SAMBA_3_2/source/utils SAMBA_3_2_0/source/include SAMBA_3_2_0/source/libgpo SAMBA_3_2_0/source/utils

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 14:47:08 + (Tue, 14 Aug 2007)
New Revision: 24413

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24413

Log:
Minor edits for libgpo.

Guenther

Modified:
   branches/SAMBA_3_2/source/include/gpo.h
   branches/SAMBA_3_2/source/libgpo/gpo_ldap.c
   branches/SAMBA_3_2/source/libgpo/gpo_parse.c
   branches/SAMBA_3_2/source/libgpo/gpo_sec.c
   branches/SAMBA_3_2/source/libgpo/gpo_util.c
   branches/SAMBA_3_2/source/utils/net_ads_gpo.c
   branches/SAMBA_3_2_0/source/include/gpo.h
   branches/SAMBA_3_2_0/source/libgpo/gpo_ldap.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_parse.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_sec.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_util.c
   branches/SAMBA_3_2_0/source/utils/net_ads_gpo.c


Changeset:
Sorry, the patch is too large (3955 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24413


svn commit: samba r24414 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 14:50:49 + (Tue, 14 Aug 2007)
New Revision: 24414

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24414

Log:
Convert reply_mv to the new API
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-14 14:47:08 UTC (rev 
24413)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 14:50:49 UTC (rev 
24414)
@@ -697,7 +697,7 @@
 /* 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 },
-/* 0x07 */ { SMBmv,reply_mv,NULL,AS_USER | NEED_WRITE },
+/* 0x07 */ { SMBmv,NULL,reply_mv,AS_USER | NEED_WRITE },
 /* 0x08 */ { SMBgetatr,reply_getatr,NULL,AS_USER},
 /* 0x09 */ { SMBsetatr,reply_setatr,NULL,AS_USER | NEED_WRITE},
 /* 0x0a */ { SMBread,reply_read,NULL,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 14:47:08 UTC (rev 
24413)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 14:50:49 UTC (rev 
24414)
@@ -5173,75 +5173,94 @@
  Reply to a mv.
 /
 
-int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, 
-int dum_buffsize)
+void reply_mv(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
pstring name;
pstring newname;
char *p;
-   uint32 attrs = SVAL(inbuf,smb_vwv0);
+   uint32 attrs;
NTSTATUS status;
BOOL src_has_wcard = False;
BOOL dest_has_wcard = False;
-   struct smb_request req;
 
START_PROFILE(SMBmv);
 
-   init_smb_request(req, (uint8 *)inbuf);
+   if (req-wct  1) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBmv);
+   return;
+   }
 
-   p = smb_buf(inbuf) + 1;
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, p,
+   attrs = SVAL(req-inbuf,smb_vwv0);
+
+   p = smb_buf(req-inbuf) + 1;
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, name, p,
   sizeof(name), 0, STR_TERMINATE, status,
   src_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBmv);
-   return ERROR_NT(status);
+   return;
}
p++;
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p,
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, newname, p,
   sizeof(newname), 0, STR_TERMINATE, status,
   dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBmv);
-   return ERROR_NT(status);
+   return;
}

-   status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, name, src_has_wcard);
+   status = resolve_dfspath_wcard(conn,
+  req-flags2  FLAGS2_DFS_PATHNAMES,
+  name, src_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(SMBmv);
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);
+   END_PROFILE(SMBmv);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBmv);
+   return;
}
 
-   status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, newname, dest_has_wcard);
+   status = resolve_dfspath_wcard(conn,
+  req-flags2  FLAGS2_DFS_PATHNAMES,
+  newname, dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(SMBmv);
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);
+   END_PROFILE(SMBmv);
+   return;
}
-   return 

svn commit: samba r24415 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 15:09:49 + (Tue, 14 Aug 2007)
New Revision: 24415

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24415

Log:
Convert reply_getatr to the new API
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-14 14:50:49 UTC (rev 
24414)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 15:09:49 UTC (rev 
24415)
@@ -698,7 +698,7 @@
 /* 0x05 */ { SMBflush,NULL,reply_flush,AS_USER},
 /* 0x06 */ { SMBunlink,NULL,reply_unlink,AS_USER | NEED_WRITE },
 /* 0x07 */ { SMBmv,NULL,reply_mv,AS_USER | NEED_WRITE },
-/* 0x08 */ { SMBgetatr,reply_getatr,NULL,AS_USER},
+/* 0x08 */ { SMBgetatr,NULL,reply_getatr,AS_USER},
 /* 0x09 */ { SMBsetatr,reply_setatr,NULL,AS_USER | NEED_WRITE},
 /* 0x0a */ { SMBread,reply_read,NULL,AS_USER},
 /* 0x0b */ { SMBwrite,reply_write,NULL,AS_USER | CAN_IPC },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 14:50:49 UTC (rev 
24414)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:09:49 UTC (rev 
24415)
@@ -886,10 +886,9 @@
  Reply to a getatr.
 /
 
-int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_getatr(connection_struct *conn, struct smb_request *req)
 {
pstring fname;
-   int outsize = 0;
SMB_STRUCT_STAT sbuf;
int mode=0;
SMB_OFF_T size=0;
@@ -899,21 +898,27 @@
 
START_PROFILE(SMBgetatr);
 
-   p = smb_buf(inbuf) + 1;
-   p += srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, p,
+   p = smb_buf(req-inbuf) + 1;
+   p += srvstr_get_path((char *)req-inbuf, req-flags2, fname, p,
 sizeof(fname), 0, STR_TERMINATE, status);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBgetatr);
-   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(SMBgetatr);
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);
+   END_PROFILE(SMBgetatr);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBgetatr);
+   return;
}
   
/* dos smetimes asks for a stat of  - it returns a hidden directory
@@ -928,18 +933,22 @@
} else {
status = unix_convert(conn, fname, False, NULL,sbuf);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBgetatr);
-   return ERROR_NT(status);
+   return;
}
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3,(reply_getatr: check_name of %s failed 
(%s)\n,fname,nt_errstr(status)));
+   reply_nterror(req, status);
END_PROFILE(SMBgetatr);
-   return ERROR_NT(status);
+   return;
}
if (!VALID_STAT(sbuf)  (SMB_VFS_STAT(conn,fname,sbuf) != 0)) 
{
DEBUG(3,(reply_getatr: stat of %s failed 
(%s)\n,fname,strerror(errno)));
-   return UNIXERROR(ERRDOS,ERRbadfile);
+   reply_unixerror(req, ERRDOS,ERRbadfile);
+   END_PROFILE(SMBgetatr);
+   return;
}
 
mode = dos_mode(conn,fname,sbuf);
@@ -949,25 +958,26 @@
size = 0;
}
}
-  
-   outsize = set_message(inbuf,outbuf,10,0,True);
 
-   SSVAL(outbuf,smb_vwv0,mode);
+   reply_outbuf(req, 10, 0);
+
+   SSVAL(req-outbuf,smb_vwv0,mode);
if(lp_dos_filetime_resolution(SNUM(conn)) ) {
-   srv_put_dos_date3(outbuf,smb_vwv1,mtime  ~1);
+   srv_put_dos_date3((char *)req-outbuf,smb_vwv1,mtime  ~1);
} else {
-   srv_put_dos_date3(outbuf,smb_vwv1,mtime);
+  

svn commit: samba r24416 - in branches: SAMBA_3_2/source SAMBA_3_2/source/libgpo SAMBA_3_2_0/source SAMBA_3_2_0/source/libgpo

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 15:17:50 + (Tue, 14 Aug 2007)
New Revision: 24416

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24416

Log:
Some more minor edits for libgpo, mostly reformatting and moving of functions.

Guenther

Added:
   branches/SAMBA_3_2/source/libgpo/gpo_ini.c
   branches/SAMBA_3_2/source/libgpo/gpo_ini.h
   branches/SAMBA_3_2_0/source/libgpo/gpo_ini.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_ini.h
Removed:
   branches/SAMBA_3_2/source/libgpo/gpo_parse.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_parse.c
Modified:
   branches/SAMBA_3_2/source/Makefile.in
   branches/SAMBA_3_2/source/libgpo/gpo_fetch.c
   branches/SAMBA_3_2/source/libgpo/gpo_filesync.c
   branches/SAMBA_3_2/source/libgpo/gpo_util.c
   branches/SAMBA_3_2_0/source/Makefile.in
   branches/SAMBA_3_2_0/source/libgpo/gpo_fetch.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_filesync.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_util.c


Changeset:
Sorry, the patch is too large (1361 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24416


svn commit: samba r24417 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 15:26:54 + (Tue, 14 Aug 2007)
New Revision: 24417

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24417

Log:
Convert reply_setatr to the new API
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-14 15:17:50 UTC (rev 
24416)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 15:26:54 UTC (rev 
24417)
@@ -699,7 +699,7 @@
 /* 0x06 */ { SMBunlink,NULL,reply_unlink,AS_USER | NEED_WRITE },
 /* 0x07 */ { SMBmv,NULL,reply_mv,AS_USER | NEED_WRITE },
 /* 0x08 */ { SMBgetatr,NULL,reply_getatr,AS_USER},
-/* 0x09 */ { SMBsetatr,reply_setatr,NULL,AS_USER | NEED_WRITE},
+/* 0x09 */ { SMBsetatr,NULL,reply_setatr,AS_USER | NEED_WRITE},
 /* 0x0a */ { SMBread,reply_read,NULL,AS_USER},
 /* 0x0b */ { SMBwrite,reply_write,NULL,AS_USER | CAN_IPC },
 /* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:17:50 UTC (rev 
24416)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:26:54 UTC (rev 
24417)
@@ -984,10 +984,9 @@
  Reply to a setatr.
 /
 
-int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_setatr(connection_struct *conn, struct smb_request *req)
 {
pstring fname;
-   int outsize = 0;
int mode;
time_t mtime;
SMB_STRUCT_STAT sbuf;
@@ -996,33 +995,46 @@
 
START_PROFILE(SMBsetatr);
 
-   p = smb_buf(inbuf) + 1;
-   p += srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, p,
+   if (req-wct  2) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   return;
+   }
+
+   p = smb_buf(req-inbuf) + 1;
+   p += srvstr_get_path((char *)req-inbuf, req-flags2, fname, p,
 sizeof(fname), 0, STR_TERMINATE, status);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBsetatr);
-   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(SMBsetatr);
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);
+   END_PROFILE(SMBsetatr);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBsetatr);
+   return;
}
   
status = unix_convert(conn, fname, False, NULL, sbuf);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBsetatr);
-   return ERROR_NT(status);
+   return;
}
 
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBsetatr);
-   return ERROR_NT(status);
+   return;
}
 
if (fname[0] == '.'  fname[1] == '\0') {
@@ -1030,12 +1042,13 @@
 * Not sure here is the right place to catch this
 * condition. Might be moved to somewhere else later -- vl
 */
+   reply_nterror(req, NT_STATUS_ACCESS_DENIED);
END_PROFILE(SMBsetatr);
-   return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+   return;
}
 
-   mode = SVAL(inbuf,smb_vwv0);
-   mtime = srv_make_unix_date3(inbuf+smb_vwv1);
+   mode = SVAL(req-inbuf,smb_vwv0);
+   mtime = srv_make_unix_date3(req-inbuf+smb_vwv1);
   
if (mode != FILE_ATTRIBUTE_NORMAL) {
if (VALID_STAT_OF_DIR(sbuf))
@@ -1044,22 +1057,24 @@
mode = ~aDIR;
 
if (file_set_dosmode(conn,fname,mode,sbuf,False) != 0) {
+   reply_unixerror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBsetatr);
-   return UNIXERROR(ERRDOS, ERRnoaccess);
+   return;
}
}
 
if (!set_filetime(conn,fname,convert_time_t_to_timespec(mtime))) {
+   

svn commit: samba r24418 - in branches: SAMBA_3_2/source/registry SAMBA_3_2_0/source/registry

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 15:29:42 + (Tue, 14 Aug 2007)
New Revision: 24418

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24418

Log:
Adding reg_deleteallvalues().

Guenther

Modified:
   branches/SAMBA_3_2/source/registry/reg_api.c
   branches/SAMBA_3_2_0/source/registry/reg_api.c


Changeset:
Modified: branches/SAMBA_3_2/source/registry/reg_api.c
===
--- branches/SAMBA_3_2/source/registry/reg_api.c2007-08-14 15:26:54 UTC 
(rev 24417)
+++ branches/SAMBA_3_2/source/registry/reg_api.c2007-08-14 15:29:42 UTC 
(rev 24418)
@@ -618,7 +618,31 @@
return WERR_OK;
 }
 
+WERROR reg_deleteallvalues(struct registry_key *key)
+{
+   WERROR err;
+   int i;
 
+   if (!(key-key-access_granted  SEC_RIGHTS_SET_VALUE)) {
+   return WERR_ACCESS_DENIED;
+   }
+
+   if (!W_ERROR_IS_OK(err = fill_value_cache(key))) {
+   return err;
+   }
+
+   for (i=0; ikey-values-num_values; i++) {
+   regval_ctr_delvalue(key-values, 
key-values-values[i]-valuename);
+   }
+
+   if (!store_reg_values(key-key, key-values)) {
+   TALLOC_FREE(key-values);
+   return WERR_REG_IO_FAILURE;
+   }
+
+   return WERR_OK;
+}
+
 /*
  * Utility function to open a complete registry path including the hive
  * prefix. This should become the replacement function for

Modified: branches/SAMBA_3_2_0/source/registry/reg_api.c
===
--- branches/SAMBA_3_2_0/source/registry/reg_api.c  2007-08-14 15:26:54 UTC 
(rev 24417)
+++ branches/SAMBA_3_2_0/source/registry/reg_api.c  2007-08-14 15:29:42 UTC 
(rev 24418)
@@ -618,7 +618,31 @@
return WERR_OK;
 }
 
+WERROR reg_deleteallvalues(struct registry_key *key)
+{
+   WERROR err;
+   int i;
 
+   if (!(key-key-access_granted  SEC_RIGHTS_SET_VALUE)) {
+   return WERR_ACCESS_DENIED;
+   }
+
+   if (!W_ERROR_IS_OK(err = fill_value_cache(key))) {
+   return err;
+   }
+
+   for (i=0; ikey-values-num_values; i++) {
+   regval_ctr_delvalue(key-values, 
key-values-values[i]-valuename);
+   }
+
+   if (!store_reg_values(key-key, key-values)) {
+   TALLOC_FREE(key-values);
+   return WERR_REG_IO_FAILURE;
+   }
+
+   return WERR_OK;
+}
+
 /*
  * Utility function to open a complete registry path including the hive
  * prefix. This should become the replacement function for



svn commit: samba r24419 - in branches: SAMBA_3_2/source/include SAMBA_3_2_0/source/include

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 15:31:36 + (Tue, 14 Aug 2007)
New Revision: 24419

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24419

Log:
Hm, I think this protoype is not required here.

Guenther

Modified:
   branches/SAMBA_3_2/source/include/includes.h
   branches/SAMBA_3_2_0/source/include/includes.h


Changeset:
Modified: branches/SAMBA_3_2/source/include/includes.h
===
--- branches/SAMBA_3_2/source/include/includes.h2007-08-14 15:29:42 UTC 
(rev 24418)
+++ branches/SAMBA_3_2/source/include/includes.h2007-08-14 15:31:36 UTC 
(rev 24419)
@@ -1211,11 +1211,6 @@
  const char *keytab_name, 
  BOOL write_access, 
  krb5_keytab *keytab);
-NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
- const char *name,
- const char *pass,
- time_t time_offset,
- PAC_DATA **pac_ret);
 #endif /* HAVE_KRB5 */
 
 

Modified: branches/SAMBA_3_2_0/source/include/includes.h
===
--- branches/SAMBA_3_2_0/source/include/includes.h  2007-08-14 15:29:42 UTC 
(rev 24418)
+++ branches/SAMBA_3_2_0/source/include/includes.h  2007-08-14 15:31:36 UTC 
(rev 24419)
@@ -1215,11 +1215,6 @@
  const char *keytab_name, 
  BOOL write_access, 
  krb5_keytab *keytab);
-NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
- const char *name,
- const char *pass,
- time_t time_offset,
- PAC_DATA **pac_ret);
 #endif /* HAVE_KRB5 */
 
 



svn commit: samba r24420 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 15:34:34 + (Tue, 14 Aug 2007)
New Revision: 24420

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24420

Log:
Pure pedantism: the talloc_init could have failed...

Guenther

Modified:
   branches/SAMBA_3_2/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_dual.c  2007-08-14 15:31:36 UTC 
(rev 24419)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_dual.c  2007-08-14 15:34:34 UTC 
(rev 24420)
@@ -758,9 +758,8 @@
} else {
result = methods-lockout_policy(child-domain, mem_ctx, 
lockout_policy);
}
+   TALLOC_FREE(mem_ctx);
 
-   talloc_destroy(mem_ctx);
-
if (!NT_STATUS_IS_OK(result)) {
DEBUG(10,(account_lockout_policy_handler: lockout_policy 
failed error %s\n,
 nt_errstr(result)));

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_dual.c2007-08-14 
15:31:36 UTC (rev 24419)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_dual.c2007-08-14 
15:34:34 UTC (rev 24420)
@@ -758,9 +758,8 @@
} else {
result = methods-lockout_policy(child-domain, mem_ctx, 
lockout_policy);
}
+   TALLOC_FREE(mem_ctx);
 
-   talloc_destroy(mem_ctx);
-
if (!NT_STATUS_IS_OK(result)) {
DEBUG(10,(account_lockout_policy_handler: lockout_policy 
failed error %s\n,
 nt_errstr(result)));



svn commit: samba r24421 - in branches/SAMBA_3_2/source/script: .

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 15:40:49 + (Tue, 14 Aug 2007)
New Revision: 24421

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24421

Log:
Ignore long #defines (like for registry keys).

Guenther

Modified:
   branches/SAMBA_3_2/source/script/count_80_col.pl


Changeset:
Modified: branches/SAMBA_3_2/source/script/count_80_col.pl
===
--- branches/SAMBA_3_2/source/script/count_80_col.pl2007-08-14 15:34:34 UTC 
(rev 24420)
+++ branches/SAMBA_3_2/source/script/count_80_col.pl2007-08-14 15:40:49 UTC 
(rev 24421)
@@ -3,7 +3,8 @@
 open( INFILE, $ARGV[0] ) || die $@;
 
 $count = 0;
-while ( INFILE ) { 
+while ( INFILE ) {
+   next if ($_ =~ /^#define/);
$count++ if (length($_)  80);
 }
 



svn commit: samba r24422 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 15:42:39 + (Tue, 14 Aug 2007)
New Revision: 24422

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24422

Log:
Convert reply_ctemp to the new API
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-14 15:40:49 UTC (rev 
24421)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 15:42:39 UTC (rev 
24422)
@@ -704,7 +704,7 @@
 /* 0x0b */ { SMBwrite,reply_write,NULL,AS_USER | CAN_IPC },
 /* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER},
 /* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER},
-/* 0x0e */ { SMBctemp,reply_ctemp,NULL,AS_USER },
+/* 0x0e */ { SMBctemp,NULL,reply_ctemp,AS_USER },
 /* 0x0f */ { SMBmknew,NULL,reply_mknew,AS_USER},
 /* 0x10 */ { SMBcheckpath,NULL,reply_checkpath,AS_USER},
 /* 0x11 */ { SMBexit,NULL,reply_exit,DO_CHDIR},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:40:49 UTC (rev 
24421)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:42:39 UTC (rev 
24422)
@@ -1924,29 +1924,35 @@
  Reply to a create temporary file.
 /
 
-int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_ctemp(connection_struct *conn, struct smb_request *req)
 {
pstring fname;
-   int outsize = 0;
-   uint32 fattr = SVAL(inbuf,smb_vwv0);
+   uint32 fattr;
files_struct *fsp;
-   int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
+   int oplock_request;
int tmpfd;
SMB_STRUCT_STAT sbuf;
-   char *p, *s;
+   char *s;
NTSTATUS status;
-   unsigned int namelen;
-   struct smb_request req;
 
START_PROFILE(SMBctemp);
 
-   init_smb_request(req, (uint8 *)inbuf);
+   if (req-wct  3) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBctemp);
+   return;
+   }
 
-   srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
-   sizeof(fname), 0, STR_TERMINATE, status);
+   fattr = SVAL(req-inbuf,smb_vwv0);
+   oplock_request = CORE_OPLOCK_REQUEST(req-inbuf);
+
+   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(SMBctemp);
-   return ERROR_NT(status);
+   return;
}
if (*fname) {
pstrcat(fname,/TMXX);
@@ -1954,37 +1960,45 @@
pstrcat(fname,TMXX);
}
 
-   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(SMBctemp);
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);
+   END_PROFILE(SMBctemp);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBctemp);
+   return;
}
 
status = unix_convert(conn, fname, False, NULL, sbuf);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBctemp);
-   return ERROR_NT(status);
+   return;
}
 
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBctemp);
-   return ERROR_NT(status);
+   return;
}
   
tmpfd = smb_mkstemp(fname);
if (tmpfd == -1) {
+   reply_unixerror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBctemp);
-   return(UNIXERROR(ERRDOS,ERRnoaccess));
+   return;
}
 
SMB_VFS_STAT(conn,fname,sbuf);
 
/* We should fail if file does not exist. */
-   status = open_file_ntcreate(conn, req, fname, sbuf,
+   status = open_file_ntcreate(conn, req, fname, sbuf,
FILE_GENERIC_READ | FILE_GENERIC_WRITE,

svn commit: samba r24423 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 16:04:31 + (Tue, 14 Aug 2007)
New Revision: 24423

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24423

Log:
Convert reply_lseek to the new API
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-14 15:42:39 UTC (rev 
24422)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 16:04:31 UTC (rev 
24423)
@@ -708,7 +708,7 @@
 /* 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},
+/* 0x12 */ { SMBlseek,NULL,reply_lseek,AS_USER},
 /* 0x13 */ { SMBlockread,reply_lockread,NULL,AS_USER},
 /* 0x14 */ { SMBwriteunlock,reply_writeunlock,NULL,AS_USER},
 /* 0x15 */ { NULL, NULL, NULL, 0 },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 15:42:39 UTC (rev 
24422)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 16:04:31 UTC (rev 
24423)
@@ -3636,22 +3636,32 @@
  Reply to a lseek.
 /
 
-int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int size, 
int dum_buffsize)
+void reply_lseek(connection_struct *conn, struct smb_request *req)
 {
SMB_OFF_T startpos;
SMB_OFF_T res= -1;
int mode,umode;
-   int outsize = 0;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBlseek);
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  4) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBlseek);
+   return;
+   }
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   return;
+   }
+
flush_write_cache(fsp, SEEK_FLUSH);
 
-   mode = SVAL(inbuf,smb_vwv1)  3;
+   mode = SVAL(req-inbuf,smb_vwv1)  3;
/* NB. This doesn't use IVAL_TO_SMB_OFF_T as startpos can be signed in 
this case. */
-   startpos = (SMB_OFF_T)IVALS(inbuf,smb_vwv2);
+   startpos = (SMB_OFF_T)IVALS(req-inbuf,smb_vwv2);
 
switch (mode) {
case 0:
@@ -3678,8 +3688,10 @@
SMB_STRUCT_STAT sbuf;
 
if(SMB_VFS_FSTAT(fsp,fsp-fh-fd, sbuf) == -1) 
{
+   reply_unixerror(req, ERRDOS,
+   ERRnoaccess);
END_PROFILE(SMBlseek);
-   return(UNIXERROR(ERRDOS,ERRnoaccess));
+   return;
}
 
current_pos += sbuf.st_size;
@@ -3689,21 +3701,22 @@
}
 
if(res == -1) {
+   reply_unixerror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBlseek);
-   return(UNIXERROR(ERRDOS,ERRnoaccess));
+   return;
}
}
 
fsp-fh-pos = res;
+
+   reply_outbuf(req, 2, 0);
+   SIVAL(req-outbuf,smb_vwv0,res);
   
-   outsize = set_message(inbuf,outbuf,2,0,True);
-   SIVAL(outbuf,smb_vwv0,res);
-  
DEBUG(3,(lseek fnum=%d ofs=%.0f newpos = %.0f mode=%d\n,
fsp-fnum, (double)startpos, (double)res, mode));
 
END_PROFILE(SMBlseek);
-   return(outsize);
+   return;
 }
 
 /



svn commit: samba r24424 - in branches: SAMBA_3_2/source/libads SAMBA_3_2_0/source/libads

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 16:04:37 + (Tue, 14 Aug 2007)
New Revision: 24424

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24424

Log:
Fix the build.

Guenther

Modified:
   branches/SAMBA_3_2/source/libads/authdata.c
   branches/SAMBA_3_2_0/source/libads/authdata.c


Changeset:
Modified: branches/SAMBA_3_2/source/libads/authdata.c
===
--- branches/SAMBA_3_2/source/libads/authdata.c 2007-08-14 16:04:31 UTC (rev 
24423)
+++ branches/SAMBA_3_2/source/libads/authdata.c 2007-08-14 16:04:37 UTC (rev 
24424)
@@ -958,11 +958,11 @@
 /
 /
 
- NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
- const char *name,
- const char *pass,
- time_t time_offset,
- PAC_DATA **pac_ret)
+NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
+const char *name,
+const char *pass,
+time_t time_offset,
+PAC_DATA **pac_ret)
 {
krb5_error_code ret;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;

Modified: branches/SAMBA_3_2_0/source/libads/authdata.c
===
--- branches/SAMBA_3_2_0/source/libads/authdata.c   2007-08-14 16:04:31 UTC 
(rev 24423)
+++ branches/SAMBA_3_2_0/source/libads/authdata.c   2007-08-14 16:04:37 UTC 
(rev 24424)
@@ -958,11 +958,11 @@
 /
 /
 
- NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
- const char *name,
- const char *pass,
- time_t time_offset,
- PAC_DATA **pac_ret)
+NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
+const char *name,
+const char *pass,
+time_t time_offset,
+PAC_DATA **pac_ret)
 {
krb5_error_code ret;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;



svn commit: samba-web r1138 - in trunk/devel: .

2007-08-14 Thread deryck
Author: deryck
Date: 2007-08-14 18:02:54 + (Tue, 14 Aug 2007)
New Revision: 1138

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1138

Log:
Slight language change for better readability.


Modified:
   trunk/devel/index.html


Changeset:
Modified: trunk/devel/index.html
===
--- trunk/devel/index.html  2007-08-10 06:59:17 UTC (rev 1137)
+++ trunk/devel/index.html  2007-08-14 18:02:54 UTC (rev 1138)
@@ -18,10 +18,11 @@
 href=/samba/history/samba-3.0.25b.htmlrelease notes/a and a
 href=/samba/download/download/a)./p 
 
-pWith the release of version 3 of the GPL, the Samba Team decided to release
-the next major production version of Samba under Samba 3.2.0 and discontinue
-the emfeature/em development for Samba 3.0. See the Team's a
-href=http://news.samba.org/announcements/samba_gplv3/;Announcement/a on
+pWith the release of version 3 of the GPL, the Samba Team has decided to
+release the next major production version of Samba under GPLv3.  The next 
version
+will be Samba 3.2.0 and emfeature/em development is discontinued
+for Samba 3.0. See the Team's
+a href=http://news.samba.org/announcements/samba_gplv3/;Announcement/a on
 GPLv3./p
 
 pOngoing future research is being done for Samba 4.0



svn commit: samba r24425 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 18:16:04 + (Tue, 14 Aug 2007)
New Revision: 24425

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24425

Log:
Convert reply_write to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/pipes.c
   branches/SAMBA_3_2/source/smbd/process.c
   branches/SAMBA_3_2/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/pipes.c
===
--- branches/SAMBA_3_2/source/smbd/pipes.c  2007-08-14 16:04:37 UTC (rev 
24424)
+++ branches/SAMBA_3_2/source/smbd/pipes.c  2007-08-14 18:16:04 UTC (rev 
24425)
@@ -138,24 +138,24 @@
  Reply to a write on a pipe.
 /
 
-int reply_pipe_write(char *inbuf,char *outbuf,int length,int dum_bufsize)
+void reply_pipe_write(struct smb_request *req)
 {
-   smb_np_struct *p = get_rpc_pipe_p(SVAL(inbuf,smb_vwv0));
-   uint16 vuid = SVAL(inbuf,smb_uid);
-   size_t numtowrite = SVAL(inbuf,smb_vwv1);
+   smb_np_struct *p = get_rpc_pipe_p(SVAL(req-inbuf,smb_vwv0));
+   size_t numtowrite = SVAL(req-inbuf,smb_vwv1);
int nwritten;
-   int outsize;
char *data;
 
if (!p) {
-   return(ERROR_DOS(ERRDOS,ERRbadfid));
+   reply_doserror(req, ERRDOS, ERRbadfid);
+   return;
}
 
-   if (p-vuid != vuid) {
-   return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+   if (p-vuid != req-vuid) {
+   reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+   return;
}
 
-   data = smb_buf(inbuf) + 3;
+   data = smb_buf(req-inbuf) + 3;
 
if (numtowrite == 0) {
nwritten = 0;
@@ -164,16 +164,17 @@
}
 
if ((nwritten == 0  numtowrite != 0) || (nwritten  0)) {
-   return (UNIXERROR(ERRDOS,ERRnoaccess));
+   reply_unixerror(req, ERRDOS, ERRnoaccess);
+   return;
}
-  
-   outsize = set_message(inbuf,outbuf,1,0,True);
 
-   SSVAL(outbuf,smb_vwv0,nwritten);
+   reply_outbuf(req, 1, 0);
+
+   SSVAL(req-outbuf,smb_vwv0,nwritten);
   
DEBUG(3,(write-IPC pnum=%04x nwritten=%d\n, p-pnum, nwritten));
 
-   return(outsize);
+   return;
 }
 
 /

Modified: branches/SAMBA_3_2/source/smbd/process.c
===
--- branches/SAMBA_3_2/source/smbd/process.c2007-08-14 16:04:37 UTC (rev 
24424)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 18:16:04 UTC (rev 
24425)
@@ -701,7 +701,7 @@
 /* 0x08 */ { SMBgetatr,NULL,reply_getatr,AS_USER},
 /* 0x09 */ { SMBsetatr,NULL,reply_setatr,AS_USER | NEED_WRITE},
 /* 0x0a */ { SMBread,reply_read,NULL,AS_USER},
-/* 0x0b */ { SMBwrite,reply_write,NULL,AS_USER | CAN_IPC },
+/* 0x0b */ { SMBwrite,NULL,reply_write,AS_USER | CAN_IPC },
 /* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER},
 /* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER},
 /* 0x0e */ { SMBctemp,NULL,reply_ctemp,AS_USER },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 16:04:37 UTC (rev 
24424)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:16:04 UTC (rev 
24425)
@@ -3400,36 +3400,51 @@
  Reply to a write.
 /
 
-int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int size,int 
dum_buffsize)
+void reply_write(connection_struct *conn, struct smb_request *req)
 {
size_t numtowrite;
ssize_t nwritten = -1;
SMB_OFF_T startpos;
char *data;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
-   int outsize = 0;
+   files_struct *fsp;
NTSTATUS status;
+
START_PROFILE(SMBwrite);
 
+   if (req-wct  5) {
+   END_PROFILE(SMBwrite);
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   return;
+   }
+
/* If it's an IPC, pass off the pipe handler. */
if (IS_IPC(conn)) {
+   reply_pipe_write(req);
END_PROFILE(SMBwrite);
-   return reply_pipe_write(inbuf,outbuf,size,dum_buffsize);
+   return;
}
 
-   CHECK_FSP(fsp,conn);
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   return;
+   }
+
if (!CHECK_WRITE(fsp)) {
+   reply_doserror(req, ERRDOS, ERRbadaccess);
END_PROFILE(SMBwrite);
-   return(ERROR_DOS(ERRDOS,ERRbadaccess));
+   return;
}
 
-   numtowrite = SVAL(inbuf,smb_vwv1);
-   startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv2);
-   data = smb_buf(inbuf) + 3;
+   numtowrite 

svn commit: samba r24426 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 18:33:29 + (Tue, 14 Aug 2007)
New Revision: 24426

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24426

Log:
Convert reply_read to the new API
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-14 18:16:04 UTC (rev 
24425)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 18:33:29 UTC (rev 
24426)
@@ -700,7 +700,7 @@
 /* 0x07 */ { SMBmv,NULL,reply_mv,AS_USER | NEED_WRITE },
 /* 0x08 */ { SMBgetatr,NULL,reply_getatr,AS_USER},
 /* 0x09 */ { SMBsetatr,NULL,reply_setatr,AS_USER | NEED_WRITE},
-/* 0x0a */ { SMBread,reply_read,NULL,AS_USER},
+/* 0x0a */ { SMBread,NULL,reply_read,AS_USER},
 /* 0x0b */ { SMBwrite,NULL,reply_write,AS_USER | CAN_IPC },
 /* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER},
 /* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:16:04 UTC (rev 
24425)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:33:29 UTC (rev 
24426)
@@ -2828,26 +2828,41 @@
  Reply to a read.
 /
 
-int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int size, 
int dum_buffsize)
+void reply_read(connection_struct *conn, struct smb_request *req)
 {
size_t numtoread;
ssize_t nread = 0;
char *data;
SMB_OFF_T startpos;
int outsize = 0;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBread);
 
-   CHECK_FSP(fsp,conn);
-   if (!CHECK_READ(fsp,inbuf)) {
-   return(ERROR_DOS(ERRDOS,ERRbadaccess));
+   if (req-wct  3) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBread);
+   return;
}
 
-   numtoread = SVAL(inbuf,smb_vwv1);
-   startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv2);
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
 
-   outsize = set_message(inbuf,outbuf,5,3,True);
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBread);
+   return;
+   }
+
+   if (!CHECK_READ(fsp,req-inbuf)) {
+   reply_doserror(req, ERRDOS, ERRbadaccess);
+   END_PROFILE(SMBread);
+   return;
+   }
+
+   numtoread = SVAL(req-inbuf,smb_vwv1);
+   startpos = IVAL_TO_SMB_OFF_T(req-inbuf,smb_vwv2);
+
numtoread = MIN(BUFFER_SIZE-outsize,numtoread);
+
/*
 * The requested read size cannot be greater than max_recv. JRA.
 */
@@ -2858,32 +2873,38 @@
numtoread = MIN(numtoread,max_recv);
}
 
-   data = smb_buf(outbuf) + 3;
+   reply_outbuf(req, 5, numtoread+3);
+
+   data = smb_buf(req-outbuf) + 3;
   
-   if 
(is_locked(fsp,(uint32)SVAL(inbuf,smb_pid),(SMB_BIG_UINT)numtoread,(SMB_BIG_UINT)startpos,
 READ_LOCK)) {
+   if (is_locked(fsp, (uint32)req-smbpid, (SMB_BIG_UINT)numtoread,
+ (SMB_BIG_UINT)startpos, READ_LOCK)) {
+   reply_doserror(req, ERRDOS,ERRlock);
END_PROFILE(SMBread);
-   return ERROR_DOS(ERRDOS,ERRlock);
+   return;
}
 
if (numtoread  0)
nread = read_file(fsp,data,startpos,numtoread);
 
if (nread  0) {
+   reply_unixerror(req, ERRDOS,ERRnoaccess);
END_PROFILE(SMBread);
-   return(UNIXERROR(ERRDOS,ERRnoaccess));
+   return;
}
+
+   set_message(NULL, (char *)req-outbuf, 5, nread+3, False);
+
+   SSVAL(req-outbuf,smb_vwv0,nread);
+   SSVAL(req-outbuf,smb_vwv5,nread+3);
+   SCVAL(smb_buf(req-outbuf),0,1);
+   SSVAL(smb_buf(req-outbuf),1,nread);
   
-   outsize += nread;
-   SSVAL(outbuf,smb_vwv0,nread);
-   SSVAL(outbuf,smb_vwv5,nread+3);
-   SCVAL(smb_buf(outbuf),0,1);
-   SSVAL(smb_buf(outbuf),1,nread);
-  
DEBUG( 3, ( read fnum=%d num=%d nread=%d\n,
fsp-fnum, (int)numtoread, (int)nread ) );
 
END_PROFILE(SMBread);
-   return(outsize);
+   return;
 }
 
 /



svn commit: samba r24427 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 18:52:58 + (Tue, 14 Aug 2007)
New Revision: 24427

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24427

Log:
Convert reply_lock to the new API
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-14 18:33:29 UTC (rev 
24426)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 18:52:58 UTC (rev 
24427)
@@ -702,7 +702,7 @@
 /* 0x09 */ { SMBsetatr,NULL,reply_setatr,AS_USER | NEED_WRITE},
 /* 0x0a */ { SMBread,NULL,reply_read,AS_USER},
 /* 0x0b */ { SMBwrite,NULL,reply_write,AS_USER | CAN_IPC },
-/* 0x0c */ { SMBlock,reply_lock,NULL,AS_USER},
+/* 0x0c */ { SMBlock,NULL,reply_lock,AS_USER},
 /* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER},
 /* 0x0e */ { SMBctemp,NULL,reply_ctemp,AS_USER },
 /* 0x0f */ { SMBmknew,NULL,reply_mknew,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:33:29 UTC (rev 
24426)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:52:58 UTC (rev 
24427)
@@ -3974,30 +3974,39 @@
  Reply to a lock.
 /
 
-int reply_lock(connection_struct *conn,
-  char *inbuf,char *outbuf, int length, int dum_buffsize)
+void reply_lock(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = set_message(inbuf,outbuf,0,0,False);
SMB_BIG_UINT count,offset;
NTSTATUS status;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
struct byte_range_lock *br_lck = NULL;
 
START_PROFILE(SMBlock);
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  5) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBlock);
+   return;
+   }
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBlock);
+   return;
+   }
+
release_level_2_oplocks_on_change(fsp);
 
-   count = (SMB_BIG_UINT)IVAL(inbuf,smb_vwv1);
-   offset = (SMB_BIG_UINT)IVAL(inbuf,smb_vwv3);
+   count = (SMB_BIG_UINT)IVAL(req-inbuf,smb_vwv1);
+   offset = (SMB_BIG_UINT)IVAL(req-inbuf,smb_vwv3);
 
DEBUG(3,(lock fd=%d fnum=%d offset=%.0f count=%.0f\n,
 fsp-fh-fd, fsp-fnum, (double)offset, (double)count));
 
br_lck = do_lock(smbd_messaging_context(),
fsp,
-   (uint32)SVAL(inbuf,smb_pid),
+   req-smbpid,
count,
offset,
WRITE_LOCK,
@@ -4009,12 +4018,15 @@
TALLOC_FREE(br_lck);
 
if (NT_STATUS_V(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBlock);
-   return ERROR_NT(status);
+   return;
}
 
+   reply_outbuf(req, 0, 0);
+
END_PROFILE(SMBlock);
-   return(outsize);
+   return;
 }
 
 /



svn commit: samba r24428 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 19:09:37 + (Tue, 14 Aug 2007)
New Revision: 24428

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24428

Log:
Convert reply_unlock to the new API
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-14 18:52:58 UTC (rev 
24427)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 19:09:37 UTC (rev 
24428)
@@ -703,7 +703,7 @@
 /* 0x0a */ { SMBread,NULL,reply_read,AS_USER},
 /* 0x0b */ { SMBwrite,NULL,reply_write,AS_USER | CAN_IPC },
 /* 0x0c */ { SMBlock,NULL,reply_lock,AS_USER},
-/* 0x0d */ { SMBunlock,reply_unlock,NULL,AS_USER},
+/* 0x0d */ { SMBunlock,NULL,reply_unlock,AS_USER},
 /* 0x0e */ { SMBctemp,NULL,reply_ctemp,AS_USER },
 /* 0x0f */ { SMBmknew,NULL,reply_mknew,AS_USER},
 /* 0x10 */ { SMBcheckpath,NULL,reply_checkpath,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 18:52:58 UTC (rev 
24427)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:09:37 UTC (rev 
24428)
@@ -4033,37 +4033,50 @@
  Reply to a unlock.
 /
 
-int reply_unlock(connection_struct *conn, char *inbuf,char *outbuf, int size, 
-int dum_buffsize)
+void reply_unlock(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = set_message(inbuf,outbuf,0,0,False);
SMB_BIG_UINT count,offset;
NTSTATUS status;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBunlock);
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  5) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBunlock);
+   return;
+   }
+
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBunlock);
+   return;
+   }

-   count = (SMB_BIG_UINT)IVAL(inbuf,smb_vwv1);
-   offset = (SMB_BIG_UINT)IVAL(inbuf,smb_vwv3);
+   count = (SMB_BIG_UINT)IVAL(req-inbuf,smb_vwv1);
+   offset = (SMB_BIG_UINT)IVAL(req-inbuf,smb_vwv3);

status = do_unlock(smbd_messaging_context(),
fsp,
-   (uint32)SVAL(inbuf,smb_pid),
+   req-smbpid,
count,
offset,
WINDOWS_LOCK);
 
if (NT_STATUS_V(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBunlock);
-   return ERROR_NT(status);
+   return;
}
 
DEBUG( 3, ( unlock fd=%d fnum=%d offset=%.0f count=%.0f\n,
fsp-fh-fd, fsp-fnum, (double)offset, (double)count ) );
-   
+
+   reply_outbuf(req, 0, 0);
+
END_PROFILE(SMBunlock);
-   return(outsize);
+   return;
 }
 
 #undef DBGC_CLASS



svn commit: samba r24429 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 19:20:25 + (Tue, 14 Aug 2007)
New Revision: 24429

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24429

Log:
reply_setdir is not used...
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-14 19:09:37 UTC (rev 
24428)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:20:25 UTC (rev 
24429)
@@ -5737,59 +5737,6 @@
return(outsize);
 }
 
-/
- Reply to a setdir.
-/
-
-int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
-{
-   int snum;
-   int outsize = 0;
-   pstring newdir;
-   NTSTATUS status;
-
-   START_PROFILE(pathworks_setdir);
-  
-   snum = SNUM(conn);
-   if (!CAN_SETDIR(snum)) {
-   END_PROFILE(pathworks_setdir);
-   return ERROR_DOS(ERRDOS,ERRnoaccess);
-   }
-
-   srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), newdir,
-   smb_buf(inbuf) + 1, sizeof(newdir), 0, STR_TERMINATE,
-   status);
-   if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(pathworks_setdir);
-   return ERROR_NT(status);
-   }
-  
-   status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, newdir);
-   if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(pathworks_setdir);
-   if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-   return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, 
ERRbadpath);
-   }
-   return ERROR_NT(status);
-   }
-
-   if (strlen(newdir) != 0) {
-   if (!vfs_directory_exist(conn,newdir,NULL)) {
-   END_PROFILE(pathworks_setdir);
-   return ERROR_DOS(ERRDOS,ERRbadpath);
-   }
-   set_conn_connectpath(conn,newdir);
-   }
-  
-   outsize = set_message(inbuf,outbuf,0,0,False);
-   SCVAL(outbuf,smb_reh,CVAL(inbuf,smb_reh));
-  
-   DEBUG(3,(setdir %s\n, newdir));
-
-   END_PROFILE(pathworks_setdir);
-   return(outsize);
-}
-
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_LOCKING
 



svn commit: samba r24430 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 19:29:02 + (Tue, 14 Aug 2007)
New Revision: 24430

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24430

Log:
Convert reply_writeclose to the new API
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-14 19:20:25 UTC (rev 
24429)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 19:29:02 UTC (rev 
24430)
@@ -734,7 +734,7 @@
 /* 0x29 */ { SMBcopy,reply_copy,NULL,AS_USER | NEED_WRITE },
 /* 0x2a */ { SMBmove,NULL, NULL,AS_USER | NEED_WRITE },
 /* 0x2b */ { SMBecho,NULL,reply_echo,0},
-/* 0x2c */ { SMBwriteclose,reply_writeclose,NULL,AS_USER},
+/* 0x2c */ { SMBwriteclose,NULL,reply_writeclose,AS_USER},
 /* 0x2d */ { SMBopenX,NULL,reply_open_and_X,AS_USER | CAN_IPC },
 /* 0x2e */ { SMBreadX,NULL,reply_read_and_X,AS_USER | CAN_IPC },
 /* 0x2f */ { SMBwriteX,NULL,reply_write_and_X,AS_USER | CAN_IPC },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:20:25 UTC (rev 
24429)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:29:02 UTC (rev 
24430)
@@ -3903,32 +3903,48 @@
  Reply to a writeclose (Core+ protocol).
 /
 
-int reply_writeclose(connection_struct *conn,
-char *inbuf,char *outbuf, int size, int dum_buffsize)
+void reply_writeclose(connection_struct *conn, struct smb_request *req)
 {
size_t numtowrite;
ssize_t nwritten = -1;
-   int outsize = 0;
NTSTATUS close_status = NT_STATUS_OK;
SMB_OFF_T startpos;
char *data;
struct timespec mtime;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBwriteclose);
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  6) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBwriteclose);
+   return;
+   }
+
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBwriteclose);
+   return;
+   }
if (!CHECK_WRITE(fsp)) {
-   return(ERROR_DOS(ERRDOS,ERRbadaccess));
+   reply_doserror(req, ERRDOS,ERRbadaccess);
+   END_PROFILE(SMBwriteclose);
+   return;
}
 
-   numtowrite = SVAL(inbuf,smb_vwv1);
-   startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv2);
-   mtime = convert_time_t_to_timespec(srv_make_unix_date3(inbuf+smb_vwv4));
-   data = smb_buf(inbuf) + 1;
+   numtowrite = SVAL(req-inbuf,smb_vwv1);
+   startpos = IVAL_TO_SMB_OFF_T(req-inbuf,smb_vwv2);
+   mtime = convert_time_t_to_timespec(srv_make_unix_date3(
+  req-inbuf+smb_vwv4));
+   data = smb_buf(req-inbuf) + 1;
   
-   if (numtowrite  
is_locked(fsp,(uint32)SVAL(inbuf,smb_pid),(SMB_BIG_UINT)numtowrite,(SMB_BIG_UINT)startpos,
 WRITE_LOCK)) {
+   if (numtowrite
+is_locked(fsp, (uint32)req-smbpid, (SMB_BIG_UINT)numtowrite,
+(SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+   reply_doserror(req, ERRDOS,ERRlock);
END_PROFILE(SMBwriteclose);
-   return ERROR_DOS(ERRDOS,ERRlock);
+   return;
}
   
nwritten = write_file(fsp,data,startpos,numtowrite);
@@ -3951,20 +3967,22 @@
 conn-num_files_open));
   
if(((nwritten == 0)  (numtowrite != 0))||(nwritten  0)) {
+   reply_doserror(req, ERRHRD, ERRdiskfull);
END_PROFILE(SMBwriteclose);
-   return(UNIXERROR(ERRHRD,ERRdiskfull));
+   return;
}
  
if(!NT_STATUS_IS_OK(close_status)) {
+   reply_nterror(req, close_status);
END_PROFILE(SMBwriteclose);
-   return ERROR_NT(close_status);
+   return;
}
- 
-   outsize = set_message(inbuf,outbuf,1,0,True);
+
+   reply_outbuf(req, 1, 0);
   
-   SSVAL(outbuf,smb_vwv0,nwritten);
+   SSVAL(req-outbuf,smb_vwv0,nwritten);
END_PROFILE(SMBwriteclose);
-   return(outsize);
+   return;
 }
 
 #undef DBGC_CLASS



svn commit: samba r24431 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 19:45:24 + (Tue, 14 Aug 2007)
New Revision: 24431

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24431

Log:
Convert the reply_printXX calls to the new API
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-14 19:29:02 UTC (rev 
24430)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 19:45:24 UTC (rev 
24431)
@@ -882,10 +882,10 @@
 /* 0xbd */ { NULL, NULL, NULL, 0 },
 /* 0xbe */ { NULL, NULL, NULL, 0 },
 /* 0xbf */ { NULL, NULL, NULL, 0 },
-/* 0xc0 */ { SMBsplopen,reply_printopen,NULL,AS_USER},
-/* 0xc1 */ { SMBsplwr,reply_printwrite,NULL,AS_USER},
-/* 0xc2 */ { SMBsplclose,reply_printclose,NULL,AS_USER},
-/* 0xc3 */ { SMBsplretq,reply_printqueue,NULL,AS_USER},
+/* 0xc0 */ { SMBsplopen,NULL,reply_printopen,AS_USER},
+/* 0xc1 */ { SMBsplwr,NULL,reply_printwrite,AS_USER},
+/* 0xc2 */ { SMBsplclose,NULL,reply_printclose,AS_USER},
+/* 0xc3 */ { SMBsplretq,NULL,reply_printqueue,AS_USER},
 /* 0xc4 */ { NULL, NULL, NULL, 0 },
 /* 0xc5 */ { NULL, NULL, NULL, 0 },
 /* 0xc6 */ { NULL, NULL, NULL, 0 },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:29:02 UTC (rev 
24430)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 19:45:24 UTC (rev 
24431)
@@ -4187,55 +4187,72 @@
  Reply to a printopen.
 /
 
-int reply_printopen(connection_struct *conn, 
-   char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_printopen(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
files_struct *fsp;
NTSTATUS status;

START_PROFILE(SMBsplopen);
-   
+
+   if (req-wct  2) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBsplopen);
+   return;
+   }
+
if (!CAN_PRINT(conn)) {
+   reply_doserror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBsplopen);
-   return ERROR_DOS(ERRDOS,ERRnoaccess);
+   return;
}
 
/* Open for exclusive use, write only. */
status = print_fsp_open(conn, NULL, fsp);
 
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBsplopen);
-   return(ERROR_NT(status));
+   return;
}
 
-   outsize = set_message(inbuf,outbuf,1,0,True);
-   SSVAL(outbuf,smb_vwv0,fsp-fnum);
+   reply_outbuf(req, 1, 0);
+   SSVAL(req-outbuf,smb_vwv0,fsp-fnum);
   
DEBUG(3,(openprint fd=%d fnum=%d\n,
 fsp-fh-fd, fsp-fnum));
 
END_PROFILE(SMBsplopen);
-   return(outsize);
+   return;
 }
 
 /
  Reply to a printclose.
 /
 
-int reply_printclose(connection_struct *conn,
-char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_printclose(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = set_message(inbuf,outbuf,0,0,False);
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
NTSTATUS status;
+
START_PROFILE(SMBsplclose);
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  3) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBsplclose);
+   return;
+   }
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBsplclose);
+return;
+}
+
if (!CAN_PRINT(conn)) {
+   reply_nterror(req, NT_STATUS_DOS(ERRSRV, ERRerror));
END_PROFILE(SMBsplclose);
-   return ERROR_NT(NT_STATUS_DOS(ERRSRV, ERRerror));
+   return;
}
   
DEBUG(3,(printclose fd=%d fnum=%d\n,
@@ -4244,39 +4261,50 @@
status = close_file(fsp,NORMAL_CLOSE);
 
if(!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBsplclose);
-   return ERROR_NT(status);
+   return;
}
 
END_PROFILE(SMBsplclose);
-   return(outsize);
+   return;
 }
 
 /
  Reply to a printqueue.
 /
 
-int reply_printqueue(connection_struct *conn,
-char 

svn commit: samba r24433 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 20:02:11 + (Tue, 14 Aug 2007)
New Revision: 24433

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24433

Log:
Convert reply_ntrename to the new API
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-14 19:47:57 UTC (rev 
24432)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-14 20:02:11 UTC (rev 
24433)
@@ -1940,76 +1940,94 @@
  Reply to a NT rename request.
 /
 
-int reply_ntrename(connection_struct *conn,
-  char *inbuf,char *outbuf,int length,int bufsize)
+void reply_ntrename(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
pstring oldname;
pstring newname;
char *p;
NTSTATUS status;
BOOL src_has_wcard = False;
BOOL dest_has_wcard = False;
-   uint32 attrs = SVAL(inbuf,smb_vwv0);
-   uint16 rename_type = SVAL(inbuf,smb_vwv1);
-   struct smb_request req;
+   uint32 attrs;
+   uint16 rename_type;
 
START_PROFILE(SMBntrename);
 
-   init_smb_request(req, (uint8 *)inbuf);
+   if (req-wct  4) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBntrename);
+   return;
+   }
 
-   p = smb_buf(inbuf) + 1;
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), oldname, p,
+   attrs = SVAL(req-inbuf,smb_vwv0);
+   rename_type = SVAL(req-inbuf,smb_vwv1);
+
+   p = smb_buf(req-inbuf) + 1;
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, oldname, p,
   sizeof(oldname), 0, STR_TERMINATE, status,
   src_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBntrename);
-   return ERROR_NT(status);
+   return;
}
 
if( is_ntfs_stream_name(oldname)) {
/* Can't rename a stream. */
+   reply_nterror(req, NT_STATUS_ACCESS_DENIED);
END_PROFILE(SMBntrename);
-   return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+   return;
}
 
if (ms_has_wild(oldname)) {
+   reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
END_PROFILE(SMBntrename);
-   return ERROR_NT(NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
+   return;
}
 
p++;
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p,
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, newname, p,
   sizeof(newname), 0, STR_TERMINATE, status,
   dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBntrename);
-   return ERROR_NT(status);
+   return;
}

-   status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, oldname);
+   status = resolve_dfspath(conn, req-flags2  FLAGS2_DFS_PATHNAMES,
+oldname);
if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(SMBntrename);
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);
+   END_PROFILE(SMBntrename);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBntrename);
+   return;
}
 
-   status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, newname);
+   status = resolve_dfspath(conn, req-flags2  FLAGS2_DFS_PATHNAMES,
+newname);
if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(SMBntrename);
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);
+   END_PROFILE(SMBntrename);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBntrename);
+   return;
}
 
DEBUG(3,(reply_ntrename : %s 

svn commit: samba r24434 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 20:06:11 + (Tue, 14 Aug 2007)
New Revision: 24434

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24434

Log:
Simplify winbindd_raw_kerberos_login().

Guenther

Modified:
   branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:02:11 UTC 
(rev 24433)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:06:11 UTC 
(rev 24434)
@@ -422,13 +422,6 @@
 #ifdef HAVE_KRB5
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
krb5_error_code krb5_ret;
-   DATA_BLOB tkt, session_key_krb5;
-   DATA_BLOB ap_rep, session_key;
-   PAC_DATA *pac_data = NULL;
-   PAC_LOGON_INFO *logon_info = NULL;
-   char *client_princ = NULL;
-   char *client_princ_out = NULL;
-   char *local_service = NULL;
const char *cc = NULL;
const char *principal_s = NULL;
const char *service = NULL;
@@ -441,11 +434,6 @@
time_t time_offset = 0;
BOOL internal_ccache = True;
 
-   ZERO_STRUCT(session_key);
-   ZERO_STRUCT(session_key_krb5);
-   ZERO_STRUCT(tkt);
-   ZERO_STRUCT(ap_rep);
-
ZERO_STRUCTP(info3);
 
*info3 = NULL;
@@ -497,115 +485,37 @@
/* if this is a user ccache, we need to act as the user to let the krb5
 * library handle the chown, etc. */
 
-   / NON-ROOT **/
+   / ENTERING NON-ROOT **/
 
if (!internal_ccache) {
-
set_effective_uid(uid);
DEBUG(10,(winbindd_raw_kerberos_login: uid is %d\n, uid));
}
 
-   krb5_ret = kerberos_kinit_password_ext(principal_s, 
-  state-request.data.auth.pass, 
-  time_offset, 
-  ticket_lifetime,
-  renewal_until,
-  cc, 
-  True,
-  True,
-  
WINBINDD_PAM_AUTH_KRB5_RENEW_TIME,
-  result);
-
-   if (krb5_ret) {
-   DEBUG(1,(winbindd_raw_kerberos_login: kinit failed for '%s' 
with: %s (%d)\n, 
-   principal_s, error_message(krb5_ret), krb5_ret));
-   goto failed;
-   }
-
-   /* does http_timestring use heimdals libroken strftime?? - Guenther */
-   DEBUG(10,(got TGT for %s in %s (valid until: %s (%d), renewable till: 
%s (%d))\n, 
-   principal_s, cc, 
-   http_timestring(ticket_lifetime), (int)ticket_lifetime, 
-   http_timestring(renewal_until), (int)renewal_until));
-
-   /* we cannot continue with krb5 when UF_DONT_REQUIRE_PREAUTH is set,
-* in that case fallback to NTLM - gd */ 
-
-   if ((ticket_lifetime == 0)  (renewal_until == 0)) {
-   result = NT_STATUS_INVALID_LOGON_TYPE;
-   goto failed;
-   }
-
-   client_princ = talloc_strdup(state-mem_ctx, global_myname());
-   if (client_princ == NULL) {
-   result = NT_STATUS_NO_MEMORY;
-   goto failed;
-   }
-   strlower_m(client_princ);
-
-   local_service = talloc_asprintf(state-mem_ctx, [EMAIL PROTECTED], 
client_princ, lp_realm());
-   if (local_service == NULL) {
-   DEBUG(0,(winbindd_raw_kerberos_login: out of memory\n));
-   result = NT_STATUS_NO_MEMORY;
-   goto failed;
-   }
-
-   krb5_ret = cli_krb5_get_ticket(local_service, 
-  time_offset, 
-  tkt, 
-  session_key_krb5, 
-  0, 
-  cc,
-  NULL);
-   if (krb5_ret) {
-   DEBUG(1,(winbindd_raw_kerberos_login: failed to get ticket for 
%s: %s\n, 
-   local_service, error_message(krb5_ret)));
-   result = krb5_to_nt_status(krb5_ret);
-   goto failed;
-   }
-
+   result = kerberos_return_info3_from_pac(state-mem_ctx,
+   principal_s,
+   state-request.data.auth.pass,
+   time_offset,
+   ticket_lifetime,
+   renewal_until,
+   cc,
+

svn commit: samba r24435 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 20:11:47 + (Tue, 14 Aug 2007)
New Revision: 24435

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24435

Log:
Fix typo.

Guenther

Modified:
   branches/SAMBA_3_2/source/lib/privileges.c
   branches/SAMBA_3_2_0/source/lib/privileges.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/privileges.c
===
--- branches/SAMBA_3_2/source/lib/privileges.c  2007-08-14 20:06:11 UTC (rev 
24434)
+++ branches/SAMBA_3_2/source/lib/privileges.c  2007-08-14 20:11:47 UTC (rev 
24435)
@@ -105,7 +105,7 @@
 }
 
 /*
- get a list of all privleges for all sids the in list
+ get a list of all privileges for all sids in the list
 */
 
 BOOL get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount)

Modified: branches/SAMBA_3_2_0/source/lib/privileges.c
===
--- branches/SAMBA_3_2_0/source/lib/privileges.c2007-08-14 20:06:11 UTC 
(rev 24434)
+++ branches/SAMBA_3_2_0/source/lib/privileges.c2007-08-14 20:11:47 UTC 
(rev 24435)
@@ -105,7 +105,7 @@
 }
 
 /*
- get a list of all privleges for all sids the in list
+ get a list of all privileges for all sids in the list
 */
 
 BOOL get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount)



svn commit: samba r24432 - in branches: SAMBA_3_2/source/libads SAMBA_3_2/source/utils SAMBA_3_2_0/source/libads SAMBA_3_2_0/source/utils

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 19:47:57 + (Tue, 14 Aug 2007)
New Revision: 24432

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24432

Log:
Expand kerberos_return_pac() so that it can be used in winbindd.

Guenther

Modified:
   branches/SAMBA_3_2/source/libads/authdata.c
   branches/SAMBA_3_2/source/utils/net_ads.c
   branches/SAMBA_3_2_0/source/libads/authdata.c
   branches/SAMBA_3_2_0/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_2/source/libads/authdata.c
===
--- branches/SAMBA_3_2/source/libads/authdata.c 2007-08-14 19:45:24 UTC (rev 
24431)
+++ branches/SAMBA_3_2/source/libads/authdata.c 2007-08-14 19:47:57 UTC (rev 
24432)
@@ -962,6 +962,12 @@
 const char *name,
 const char *pass,
 time_t time_offset,
+time_t *expire_time,
+time_t *renew_till_time,
+const char *cache_name,
+BOOL request_pac,
+BOOL add_netbios_addr,
+time_t renewable_time,
 PAC_DATA **pac_ret)
 {
krb5_error_code ret;
@@ -982,6 +988,10 @@
return NT_STATUS_INVALID_PARAMETER;
}
 
+   if (cache_name) {
+   cc = cache_name;
+   }
+
if (!strchr_m(name, '@')) {
auth_princ = talloc_asprintf(mem_ctx, [EMAIL PROTECTED], name,
lp_realm());
@@ -997,18 +1007,41 @@
ret = kerberos_kinit_password_ext(auth_princ,
  pass,
  time_offset,
- NULL,
- NULL,
+ expire_time,
+ renew_till_time,
  cc,
- True,
- True,
- 0,
+ request_pac,
+ add_netbios_addr,
+ renewable_time,
  status);
if (ret) {
+   DEBUG(1,(kinit failed for '%s' with: %s (%d)\n,
+   auth_princ, error_message(ret), ret));
/* status already set */
goto out;
}
 
+   DEBUG(10,(got TGT for %s in %s\n, auth_princ, cc));
+   if (expire_time) {
+   DEBUGADD(10,(\tvalid until: %s (%d)\n,
+   http_timestring(*expire_time),
+   (int)*expire_time));
+   }
+   if (renew_till_time) {
+   DEBUGADD(10,(\trenewable till: %s (%d)\n,
+   http_timestring(*renew_till_time),
+   (int)*renew_till_time));
+   }
+
+   /* we cannot continue with krb5 when UF_DONT_REQUIRE_PREAUTH is set,
+* in that case fallback to NTLM - gd */
+
+   if (expire_time  renew_till_time 
+   (*expire_time == 0)  (*renew_till_time == 0)) {
+   return NT_STATUS_INVALID_LOGON_TYPE;
+   }
+
+
ret = cli_krb5_get_ticket(local_service,
  time_offset,
  tkt,
@@ -1017,6 +1050,8 @@
  cc,
  NULL);
if (ret) {
+   DEBUG(1,(failed to get ticket for %s: %s\n,
+   local_service, error_message(ret)));
status = krb5_to_nt_status(ret);
goto out;
}
@@ -1031,10 +1066,13 @@
   sesskey2,
   False);
if (!NT_STATUS_IS_OK(status)) {
+   DEBUG(1,(ads_verify_ticket failed: %s\n,
+   nt_errstr(status)));
goto out;
}
 
if (!pac_data) {
+   DEBUG(1,(no PAC\n));
status = NT_STATUS_INVALID_PARAMETER;
goto out;
}
@@ -1042,7 +1080,9 @@
*pac_ret = pac_data;
 
 out:
-   ads_kdestroy(cc);
+   if (cc != cache_name) {
+   ads_kdestroy(cc);
+   }
 
data_blob_free(tkt);
data_blob_free(ap_rep);
@@ -1061,6 +1101,12 @@
   const char *name,
   const char *pass,
   time_t time_offset,
+  time_t *expire_time,
+  time_t *renew_till_time,
+  const char *cache_name,
+

svn commit: samba r24436 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 20:20:51 + (Tue, 14 Aug 2007)
New Revision: 24436

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24436

Log:
Convert reply_lockread/writeunlock to the new API
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-14 20:11:47 UTC (rev 
24435)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 20:20:51 UTC (rev 
24436)
@@ -709,8 +709,8 @@
 /* 0x10 */ { SMBcheckpath,NULL,reply_checkpath,AS_USER},
 /* 0x11 */ { SMBexit,NULL,reply_exit,DO_CHDIR},
 /* 0x12 */ { SMBlseek,NULL,reply_lseek,AS_USER},
-/* 0x13 */ { SMBlockread,reply_lockread,NULL,AS_USER},
-/* 0x14 */ { SMBwriteunlock,reply_writeunlock,NULL,AS_USER},
+/* 0x13 */ { SMBlockread,NULL,reply_lockread,AS_USER},
+/* 0x14 */ { SMBwriteunlock,NULL,reply_writeunlock,AS_USER},
 /* 0x15 */ { NULL, NULL, NULL, 0 },
 /* 0x16 */ { NULL, NULL, NULL, 0 },
 /* 0x17 */ { NULL, NULL, NULL, 0 },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 20:11:47 UTC (rev 
24435)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 20:20:51 UTC (rev 
24436)
@@ -2741,31 +2741,47 @@
  Reply to a lockread (core+ protocol).
 /
 
-int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int 
length, int dum_buffsiz)
+void reply_lockread(connection_struct *conn, struct smb_request *req)
 {
ssize_t nread = -1;
char *data;
-   int outsize = 0;
SMB_OFF_T startpos;
size_t numtoread;
NTSTATUS status;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
struct byte_range_lock *br_lck = NULL;
+
START_PROFILE(SMBlockread);
 
-   CHECK_FSP(fsp,conn);
-   if (!CHECK_READ(fsp,inbuf)) {
-   return(ERROR_DOS(ERRDOS,ERRbadaccess));
+   if (req-wct  5) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBlockread);
+   return;
}
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   END_PROFILE(SMBlockread);
+   return;
+   }
+
+   if (!CHECK_READ(fsp,req-inbuf)) {
+   reply_doserror(req, ERRDOS, ERRbadaccess);
+   END_PROFILE(SMBlockread);
+   return;
+   }
+
release_level_2_oplocks_on_change(fsp);
 
-   numtoread = SVAL(inbuf,smb_vwv1);
-   startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv2);
-  
-   outsize = set_message(inbuf,outbuf,5,3,True);
-   numtoread = MIN(BUFFER_SIZE-outsize,numtoread);
-   data = smb_buf(outbuf) + 3;
+   numtoread = SVAL(req-inbuf,smb_vwv1);
+   startpos = IVAL_TO_SMB_OFF_T(req-inbuf,smb_vwv2);
+
+   numtoread = MIN(BUFFER_SIZE - (smb_size + 3*2 + 3), numtoread);
+
+   reply_outbuf(req, 5, numtoread + 3);
+
+   data = smb_buf(req-outbuf) + 3;

/*
 * NB. Discovered by Menny Hamburger at Mainsoft. This is a core+
@@ -2777,7 +2793,7 @@

br_lck = do_lock(smbd_messaging_context(),
fsp,
-   (uint32)SVAL(inbuf,smb_pid), 
+   req-smbpid,
(SMB_BIG_UINT)numtoread,
(SMB_BIG_UINT)startpos,
WRITE_LOCK,
@@ -2788,8 +2804,9 @@
TALLOC_FREE(br_lck);
 
if (NT_STATUS_V(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBlockread);
-   return ERROR_NT(status);
+   return;
}
 
/*
@@ -2805,20 +2822,22 @@
nread = read_file(fsp,data,startpos,numtoread);
 
if (nread  0) {
+   reply_unixerror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBlockread);
-   return(UNIXERROR(ERRDOS,ERRnoaccess));
+   return;
}

-   outsize += nread;
-   SSVAL(outbuf,smb_vwv0,nread);
-   SSVAL(outbuf,smb_vwv5,nread+3);
-   SSVAL(smb_buf(outbuf),1,nread);
+   set_message(NULL, (char *)req-outbuf, 5, nread+3, False);
+
+   SSVAL(req-outbuf,smb_vwv0,nread);
+   SSVAL(req-outbuf,smb_vwv5,nread+3);
+   SSVAL(smb_buf(req-outbuf),1,nread);

DEBUG(3,(lockread fnum=%d num=%d nread=%d\n,
 fsp-fnum, (int)numtoread, (int)nread));
 
END_PROFILE(SMBlockread);
-   return(outsize);
+   return;
 }
 
 #undef DBGC_CLASS
@@ -3341,30 +3360,46 @@
  Reply to a writeunlock (core+).
 /
 

svn commit: samba r24437 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 20:26:35 + (Tue, 14 Aug 2007)
New Revision: 24437

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24437

Log:
Remove done in winbindd_raw_kerberos_login() as well.

Guenther

Modified:
   branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:20:51 UTC 
(rev 24436)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:26:35 UTC 
(rev 24437)
@@ -551,10 +551,8 @@
 
}
 
-   result = NT_STATUS_OK;
+   return NT_STATUS_OK;
 
-   goto done;
-
 failed:
 
/* we could have created a new credential cache with a valid tgt in it
@@ -575,10 +573,8 @@
state-request.data.auth.user));
}
 
-done:
-
return result;
-#else 
+#else
return NT_STATUS_NOT_SUPPORTED;
 #endif /* HAVE_KRB5 */
 }

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c 2007-08-14 20:20:51 UTC 
(rev 24436)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c 2007-08-14 20:26:35 UTC 
(rev 24437)
@@ -551,10 +551,8 @@
 
}
 
-   result = NT_STATUS_OK;
+   return NT_STATUS_OK;
 
-   goto done;
-
 failed:
 
/* we could have created a new credential cache with a valid tgt in it
@@ -575,10 +573,8 @@
state-request.data.auth.user));
}
 
-done:
-
return result;
-#else 
+#else
return NT_STATUS_NOT_SUPPORTED;
 #endif /* HAVE_KRB5 */
 }



svn commit: samba r24438 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-08-14 Thread gd
Author: gd
Date: 2007-08-14 20:43:02 + (Tue, 14 Aug 2007)
New Revision: 24438

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24438

Log:
Use dump_data_pw() instead of dump_data() on sensitive data in winbindd.

Guenther

Modified:
   branches/SAMBA_3_2/source/nsswitch/winbindd_cache.c
   branches/SAMBA_3_2/source/nsswitch/winbindd_creds.c
   branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_cache.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_creds.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_cache.c 2007-08-14 20:26:35 UTC 
(rev 24437)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_cache.c 2007-08-14 20:43:02 UTC 
(rev 24438)
@@ -1015,12 +1015,11 @@
*cached_salt = NULL;
}
 
-#if DEBUG_PASSWORD
-   dump_data(100, *cached_nt_pass, NT_HASH_LEN);
+   dump_data_pw(cached_nt_pass, *cached_nt_pass, NT_HASH_LEN);
if (*cached_salt) {
-   dump_data(100, *cached_salt, NT_HASH_LEN);
+   dump_data_pw(cached_salt, *cached_salt, NT_HASH_LEN);
}
-#endif
+
status = centry-status;
 
DEBUG(10,(wcache_get_creds: [Cached] - cached creds for user %s 
status: %s\n,
@@ -1056,9 +1055,7 @@
return NT_STATUS_INTERNAL_DB_ERROR;
}
 
-#if DEBUG_PASSWORD
-   dump_data(100, nt_pass, NT_HASH_LEN);
-#endif
+   dump_data_pw(nt_pass, nt_pass, NT_HASH_LEN);
 
centry_put_time(centry, time(NULL));
 

Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_creds.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_creds.c 2007-08-14 20:26:35 UTC 
(rev 24437)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_creds.c 2007-08-14 20:43:02 UTC 
(rev 24438)
@@ -117,9 +117,7 @@
 
E_md4hash(pass, nt_pass);
 
-#if DEBUG_PASSWORD
-   dump_data(100, nt_pass, NT_HASH_LEN);
-#endif
+   dump_data_pw(nt_pass, nt_pass, NT_HASH_LEN);
 
status = wcache_save_creds(domain, mem_ctx, cred_sid, nt_pass);
if (!NT_STATUS_IS_OK(status)) {

Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:26:35 UTC 
(rev 24437)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_pam.c   2007-08-14 20:43:02 UTC 
(rev 24438)
@@ -686,13 +686,11 @@
 
E_md4hash(state-request.data.auth.pass, new_nt_pass);
 
-#if DEBUG_PASSWORD
-   dump_data(100, new_nt_pass, NT_HASH_LEN);
-   dump_data(100, cached_nt_pass, NT_HASH_LEN);
+   dump_data_pw(new_nt_pass, new_nt_pass, NT_HASH_LEN);
+   dump_data_pw(cached_nt_pass, cached_nt_pass, NT_HASH_LEN);
if (cached_salt) {
-   dump_data(100, cached_salt, NT_HASH_LEN);
+   dump_data_pw(cached_salt, cached_salt, NT_HASH_LEN);
}
-#endif
 
if (cached_salt) {
/* In this case we didn't store the nt_hash itself,

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_cache.c   2007-08-14 
20:26:35 UTC (rev 24437)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_cache.c   2007-08-14 
20:43:02 UTC (rev 24438)
@@ -1015,12 +1015,11 @@
*cached_salt = NULL;
}
 
-#if DEBUG_PASSWORD
-   dump_data(100, *cached_nt_pass, NT_HASH_LEN);
+   dump_data_pw(cached_nt_pass, *cached_nt_pass, NT_HASH_LEN);
if (*cached_salt) {
-   dump_data(100, *cached_salt, NT_HASH_LEN);
+   dump_data_pw(cached_salt, *cached_salt, NT_HASH_LEN);
}
-#endif
+
status = centry-status;
 
DEBUG(10,(wcache_get_creds: [Cached] - cached creds for user %s 
status: %s\n,
@@ -1056,9 +1055,7 @@
return NT_STATUS_INTERNAL_DB_ERROR;
}
 
-#if DEBUG_PASSWORD
-   dump_data(100, nt_pass, NT_HASH_LEN);
-#endif
+   dump_data_pw(nt_pass, nt_pass, NT_HASH_LEN);
 
centry_put_time(centry, time(NULL));
 

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_creds.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_creds.c   2007-08-14 
20:26:35 UTC (rev 24437)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_creds.c   2007-08-14 
20:43:02 UTC (rev 24438)
@@ -117,9 +117,7 @@
 
E_md4hash(pass, nt_pass);
 
-#if DEBUG_PASSWORD
-   dump_data(100, nt_pass, NT_HASH_LEN);
-#endif
+   dump_data_pw(nt_pass, nt_pass, NT_HASH_LEN);
 
status = wcache_save_creds(domain, mem_ctx, 

svn commit: samba r24439 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 20:55:24 + (Tue, 14 Aug 2007)
New Revision: 24439

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24439

Log:
Convert reply_get/setattrE to the new API
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-14 20:43:02 UTC (rev 
24438)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 20:55:24 UTC (rev 
24439)
@@ -724,8 +724,8 @@
 /* 0x1f */ { SMBwriteBs,reply_writebs,NULL,AS_USER},
 /* 0x20 */ { SMBwritec,NULL, NULL,0},
 /* 0x21 */ { NULL, NULL, NULL, 0 },
-/* 0x22 */ { SMBsetattrE,reply_setattrE,NULL,AS_USER | NEED_WRITE },
-/* 0x23 */ { SMBgetattrE,reply_getattrE,NULL,AS_USER },
+/* 0x22 */ { SMBsetattrE,NULL,reply_setattrE,AS_USER | NEED_WRITE },
+/* 0x23 */ { SMBgetattrE,NULL,reply_getattrE,AS_USER },
 /* 0x24 */ { SMBlockingX,NULL,reply_lockingX,AS_USER },
 /* 0x25 */ { SMBtrans,NULL,reply_trans,AS_USER | CAN_IPC },
 /* 0x26 */ { SMBtranss,NULL,reply_transs,AS_USER | CAN_IPC},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 20:43:02 UTC (rev 
24438)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 20:55:24 UTC (rev 
24439)
@@ -6430,28 +6430,40 @@
  Reply to a SMBsetattrE.
 /
 
-int reply_setattrE(connection_struct *conn, char *inbuf,char *outbuf, int 
size, int dum_buffsize)
+void reply_setattrE(connection_struct *conn, struct smb_request *req)
 {
struct timespec ts[2];
-   int outsize = 0;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBsetattrE);
 
-   outsize = set_message(inbuf,outbuf,0,0,False);
+   if (req-wct  7) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBsetattrE);
+   return;
+   }
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
if(!fsp || (fsp-conn != conn)) {
+   reply_doserror(req, ERRDOS, ERRbadfid);
END_PROFILE(SMBsetattrE);
-   return ERROR_DOS(ERRDOS,ERRbadfid);
+   return;
}
 
+
/*
 * Convert the DOS times into unix times. Ignore create
 * time as UNIX can't set this.
 */
 
-   ts[0] = 
convert_time_t_to_timespec(srv_make_unix_date2(inbuf+smb_vwv3)); /* atime. */
-   ts[1] = 
convert_time_t_to_timespec(srv_make_unix_date2(inbuf+smb_vwv5)); /* mtime. */
+   ts[0] = convert_time_t_to_timespec(
+   srv_make_unix_date2(req-inbuf+smb_vwv3)); /* atime. */
+   ts[1] = convert_time_t_to_timespec(
+   srv_make_unix_date2(req-inbuf+smb_vwv5)); /* mtime. */
   
+   reply_outbuf(req, 0, 0);
+
/* 
 * Patch from Ray Frush [EMAIL PROTECTED]
 * Sometimes times are sent as zero - ignore them.
@@ -6464,7 +6476,7 @@
dbgtext( ignoring zero request - not setting 
timestamps of 0\n );
}
END_PROFILE(SMBsetattrE);
-   return(outsize);
+   return;
} else if (!null_timespec(ts[0])  null_timespec(ts[1])) {
/* set modify time = to access time if modify time was unset */
ts[1] = ts[0];
@@ -6473,8 +6485,9 @@
/* Set the date on this file */
/* Should we set pending modtime here ? JRA */
if(file_ntimes(conn, fsp-fsp_name, ts)) {
+   reply_doserror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBsetattrE);
-   return ERROR_DOS(ERRDOS,ERRnoaccess);
+   return;
}
   
DEBUG( 3, ( reply_setattrE fnum=%d actime=%u modtime=%u\n,
@@ -6483,7 +6496,7 @@
(unsigned int)ts[1].tv_sec));
 
END_PROFILE(SMBsetattrE);
-   return(outsize);
+   return;
 }
 
 
@@ -6699,25 +6712,33 @@
  Reply to a SMBgetattrE.
 /
 
-int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int 
size, int dum_buffsize)
+void reply_getattrE(connection_struct *conn, struct smb_request *req)
 {
SMB_STRUCT_STAT sbuf;
-   int outsize = 0;
int mode;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp;
+
START_PROFILE(SMBgetattrE);
 
-   outsize = set_message(inbuf,outbuf,11,0,True);
+   if (req-wct  1) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBgetattrE);
+   return;
+   }
 
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+
if(!fsp || (fsp-conn != conn)) {
+  

svn commit: samba r24440 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 21:07:44 + (Tue, 14 Aug 2007)
New Revision: 24440

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24440

Log:
Convert the reply_sendXX functions to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/message.c
   branches/SAMBA_3_2/source/smbd/process.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/message.c
===
--- branches/SAMBA_3_2/source/smbd/message.c2007-08-14 20:55:24 UTC (rev 
24439)
+++ branches/SAMBA_3_2/source/smbd/message.c2007-08-14 21:07:44 UTC (rev 
24440)
@@ -114,11 +114,10 @@
  conn POINTER CAN BE NULL HERE !
 /
 
-int reply_sends(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_sends(connection_struct *conn, struct smb_request *req)
 {
int len;
char *msg;
-   int outsize = 0;
char *p;
 
START_PROFILE(SMBsends);
@@ -126,16 +125,15 @@
msgpos = 0;
 
if (! (*lp_msg_command())) {
+   reply_doserror(req, ERRSRV, ERRmsgoff);
END_PROFILE(SMBsends);
-   return(ERROR_DOS(ERRSRV,ERRmsgoff));
+   return;
}
 
-   outsize = set_message(inbuf,outbuf,0,0,True);
-
-   p = smb_buf(inbuf)+1;
-   p += srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), msgfrom, p,
+   p = smb_buf(req-inbuf)+1;
+   p += srvstr_pull_buf((char *)req-inbuf, req-flags2, msgfrom, p,
 sizeof(msgfrom), STR_ASCII|STR_TERMINATE) + 1;
-   p += srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), msgto, p,
+   p += srvstr_pull_buf((char *)req-inbuf, req-flags2, msgto, p,
 sizeof(msgto), STR_ASCII|STR_TERMINATE) + 1;
 
msg = p;
@@ -150,8 +148,10 @@
 
msg_deliver();
 
+   reply_outbuf(req, 0, 0);
+
END_PROFILE(SMBsends);
-   return(outsize);
+   return;
 }
 
 /
@@ -159,33 +159,33 @@
  conn POINTER CAN BE NULL HERE !
 /
 
-int reply_sendstrt(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_sendstrt(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
char *p;
 
START_PROFILE(SMBsendstrt);
 
if (! (*lp_msg_command())) {
+   reply_doserror(req, ERRSRV, ERRmsgoff);
END_PROFILE(SMBsendstrt);
-   return(ERROR_DOS(ERRSRV,ERRmsgoff));
+   return;
}
 
-   outsize = set_message(inbuf,outbuf,1,0,True);
-
memset(msgbuf,'\0',sizeof(msgbuf));
msgpos = 0;
 
-   p = smb_buf(inbuf)+1;
-   p += srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), msgfrom, p,
+   p = smb_buf(req-inbuf)+1;
+   p += srvstr_pull_buf((char *)req-inbuf, req-flags2, msgfrom, p,
 sizeof(msgfrom), STR_ASCII|STR_TERMINATE) + 1;
-   p += srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), msgto, p,
+   p += srvstr_pull_buf((char *)req-inbuf, req-flags2, msgto, p,
 sizeof(msgto), STR_ASCII|STR_TERMINATE) + 1;
 
DEBUG( 3, ( SMBsendstrt (from %s to %s)\n, msgfrom, msgto ) );
 
+   reply_outbuf(req, 0, 0);
+
END_PROFILE(SMBsendstrt);
-   return(outsize);
+   return;
 }
 
 /
@@ -193,22 +193,20 @@
  conn POINTER CAN BE NULL HERE !
 /
 
-int reply_sendtxt(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_sendtxt(connection_struct *conn, struct smb_request *req)
 {
int len;
-   int outsize = 0;
char *msg;
START_PROFILE(SMBsendtxt);
 
if (! (*lp_msg_command())) {
+   reply_doserror(req, ERRSRV, ERRmsgoff);
END_PROFILE(SMBsendtxt);
-   return(ERROR_DOS(ERRSRV,ERRmsgoff));
+   return;
}
 
-   outsize = set_message(inbuf,outbuf,0,0,True);
+   msg = smb_buf(req-inbuf) + 1;
 
-   msg = smb_buf(inbuf) + 1;
-
len = SVAL(msg,0);
len = MIN(len,sizeof(msgbuf)-msgpos);
 
@@ -217,8 +215,10 @@
 
DEBUG( 3, ( SMBsendtxt\n ) );
 
+   reply_outbuf(req, 0, 0);
+
END_PROFILE(SMBsendtxt);
-   return(outsize);
+   return;
 }
 
 /
@@ -226,22 +226,22 @@
  conn POINTER CAN BE NULL HERE !
 /
 
-int reply_sendend(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void 

svn commit: samba r24441 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 21:13:05 + (Tue, 14 Aug 2007)
New Revision: 24441

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24441

Log:
Convert reply_ioctl to the new API
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-14 21:07:44 UTC (rev 
24440)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 21:13:05 UTC (rev 
24441)
@@ -729,7 +729,7 @@
 /* 0x24 */ { SMBlockingX,NULL,reply_lockingX,AS_USER },
 /* 0x25 */ { SMBtrans,NULL,reply_trans,AS_USER | CAN_IPC },
 /* 0x26 */ { SMBtranss,NULL,reply_transs,AS_USER | CAN_IPC},
-/* 0x27 */ { SMBioctl,reply_ioctl,NULL,0},
+/* 0x27 */ { SMBioctl,NULL,reply_ioctl,0},
 /* 0x28 */ { SMBioctls,NULL, NULL,AS_USER},
 /* 0x29 */ { SMBcopy,reply_copy,NULL,AS_USER | NEED_WRITE },
 /* 0x2a */ { SMBmove,NULL, NULL,AS_USER | NEED_WRITE },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:07:44 UTC (rev 
24440)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:13:05 UTC (rev 
24441)
@@ -724,56 +724,72 @@
  conn POINTER CAN BE NULL HERE !
 /
 
-int reply_ioctl(connection_struct *conn,
-   char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_ioctl(connection_struct *conn, struct smb_request *req)
 {
-   uint16 device = SVAL(inbuf,smb_vwv1);
-   uint16 function   = SVAL(inbuf,smb_vwv2);
-   uint32 ioctl_code = (device  16) + function;
-   int replysize, outsize;
+   uint16 device;
+   uint16 function;
+   uint32 ioctl_code;
+   int replysize;
char *p;
+
START_PROFILE(SMBioctl);
 
+   if (req-wct  3) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBioctl);
+   return;
+   }
+
+   device = SVAL(req-inbuf,smb_vwv1);
+   function   = SVAL(req-inbuf,smb_vwv2);
+   ioctl_code = (device  16) + function;
+
DEBUG(4, (Received IOCTL (code 0x%x)\n, ioctl_code));
 
switch (ioctl_code) {
case IOCTL_QUERY_JOB_INFO:
-   replysize = 32;
-   break;
+   replysize = 32;
+   break;
default:
-   END_PROFILE(SMBioctl);
-   return(ERROR_DOS(ERRSRV,ERRnosupport));
+   reply_doserror(req, ERRSRV, ERRnosupport);
+   END_PROFILE(SMBioctl);
+   return;
}
 
-   outsize = set_message(inbuf,outbuf,8,replysize+1,True);
-   SSVAL(outbuf,smb_vwv1,replysize); /* Total data bytes returned */
-   SSVAL(outbuf,smb_vwv5,replysize); /* Data bytes this buffer */
-   SSVAL(outbuf,smb_vwv6,52);/* Offset to data */
-   p = smb_buf(outbuf) + 1;  /* Allow for alignment */
+   reply_outbuf(req, 8, replysize+1);
+   SSVAL(req-outbuf,smb_vwv1,replysize); /* Total data bytes returned */
+   SSVAL(req-outbuf,smb_vwv5,replysize); /* Data bytes this buffer */
+   SSVAL(req-outbuf,smb_vwv6,52);/* Offset to data */
+   p = smb_buf(req-outbuf) + 1;  /* Allow for alignment */
 
switch (ioctl_code) {
case IOCTL_QUERY_JOB_INFO:  
{
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
+   files_struct *fsp = file_fsp(SVAL(req-inbuf,
+ smb_vwv0));
if (!fsp) {
+   reply_doserror(req, ERRDOS, ERRbadfid);
END_PROFILE(SMBioctl);
-   return(UNIXERROR(ERRDOS,ERRbadfid));
+   return;
}
SSVAL(p,0,fsp-rap_print_jobid); /* Job 
number */
-   srvstr_push(outbuf, SVAL(outbuf, smb_flg2), p+2,
+   srvstr_push((char *)req-outbuf, req-flags2, p+2,
global_myname(), 15,
STR_TERMINATE|STR_ASCII);
if (conn) {
-   srvstr_push(outbuf, SVAL(outbuf, smb_flg2),
+   srvstr_push((char *)req-outbuf, req-flags2,
p+18, lp_servicename(SNUM(conn)),
13, STR_TERMINATE|STR_ASCII);
}
+   else {
+   memset(p+18, 0, 13);
+   }
break;

svn commit: samba r24442 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 21:21:52 + (Tue, 14 Aug 2007)
New Revision: 24442

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24442

Log:
Convert reply_copy to the new API
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-14 21:13:05 UTC (rev 
24441)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 21:21:52 UTC (rev 
24442)
@@ -731,7 +731,7 @@
 /* 0x26 */ { SMBtranss,NULL,reply_transs,AS_USER | CAN_IPC},
 /* 0x27 */ { SMBioctl,NULL,reply_ioctl,0},
 /* 0x28 */ { SMBioctls,NULL, NULL,AS_USER},
-/* 0x29 */ { SMBcopy,reply_copy,NULL,AS_USER | NEED_WRITE },
+/* 0x29 */ { SMBcopy,NULL,reply_copy,AS_USER | NEED_WRITE },
 /* 0x2a */ { SMBmove,NULL, NULL,AS_USER | NEED_WRITE },
 /* 0x2b */ { SMBecho,NULL,reply_echo,0},
 /* 0x2c */ { SMBwriteclose,NULL,reply_writeclose,AS_USER},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:13:05 UTC (rev 
24441)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:21:52 UTC (rev 
24442)
@@ -5640,9 +5640,8 @@
  Reply to a file copy.
 /
 
-int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_copy(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
pstring name;
pstring directory;
pstring mask,newname;
@@ -5650,32 +5649,45 @@
int count=0;
int error = ERRnoaccess;
int err = 0;
-   int tid2 = SVAL(inbuf,smb_vwv0);
-   int ofun = SVAL(inbuf,smb_vwv1);
-   int flags = SVAL(inbuf,smb_vwv2);
+   int tid2;
+   int ofun;
+   int flags;
BOOL target_is_directory=False;
BOOL source_has_wild = False;
BOOL dest_has_wild = False;
SMB_STRUCT_STAT sbuf1, sbuf2;
NTSTATUS status;
+
START_PROFILE(SMBcopy);
 
+   if (req-wct  3) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBcopy);
+   return;
+   }
+
+   tid2 = SVAL(req-inbuf,smb_vwv0);
+   ofun = SVAL(req-inbuf,smb_vwv1);
+   flags = SVAL(req-inbuf,smb_vwv2);
+
*directory = *mask = 0;
 
-   p = smb_buf(inbuf);
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, p,
+   p = smb_buf(req-inbuf);
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, name, p,
   sizeof(name), 0, STR_TERMINATE, status,
   source_has_wild);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBcopy);
-   return ERROR_NT(status);
+   return;
}
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p,
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, newname, p,
   sizeof(newname), 0, STR_TERMINATE, status,
   dest_has_wild);
if (!NT_STATUS_IS_OK(status)) {
+   reply_nterror(req, status);
END_PROFILE(SMBcopy);
-   return ERROR_NT(status);
+   return;
}

DEBUG(3,(reply_copy : %s - %s\n,name,newname));
@@ -5683,57 +5695,75 @@
if (tid2 != conn-cnum) {
/* can't currently handle inter share copies  */
DEBUG(3,(Rejecting inter-share copy\n));
+   reply_doserror(req, ERRSRV, ERRinvdevice);
END_PROFILE(SMBcopy);
-   return ERROR_DOS(ERRSRV,ERRinvdevice);
+   return;
}
 
-   status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, name, source_has_wild);
+   status = resolve_dfspath_wcard(conn,
+  req-flags2  FLAGS2_DFS_PATHNAMES,
+  name, source_has_wild);
if (!NT_STATUS_IS_OK(status)) {
-   END_PROFILE(SMBcopy);
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);
+   END_PROFILE(SMBcopy);
+   return;
}
-   return ERROR_NT(status);
+   reply_nterror(req, status);
+   END_PROFILE(SMBcopy);
+   return;
}
 
-   status = resolve_dfspath_wcard(conn, 

svn commit: samba r24443 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 21:32:52 + (Tue, 14 Aug 2007)
New Revision: 24443

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24443

Log:
Convert reply_search/fclose to the new API
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-14 21:21:52 UTC (rev 
24442)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 21:32:52 UTC (rev 
24443)
@@ -819,10 +819,10 @@
 /* 0x7e */ { NULL, NULL, NULL, 0 },
 /* 0x7f */ { NULL, NULL, NULL, 0 },
 /* 0x80 */ { SMBdskattr,NULL,reply_dskattr,AS_USER},
-/* 0x81 */ { SMBsearch,reply_search,NULL,AS_USER},
-/* 0x82 */ { SMBffirst,reply_search,NULL,AS_USER},
-/* 0x83 */ { SMBfunique,reply_search,NULL,AS_USER},
-/* 0x84 */ { SMBfclose,reply_fclose,NULL,AS_USER},
+/* 0x81 */ { SMBsearch,NULL,reply_search,AS_USER},
+/* 0x82 */ { SMBffirst,NULL,reply_search,AS_USER},
+/* 0x83 */ { SMBfunique,NULL,reply_search,AS_USER},
+/* 0x84 */ { SMBfclose,NULL,reply_fclose,AS_USER},
 /* 0x85 */ { NULL, NULL, NULL, 0 },
 /* 0x86 */ { NULL, NULL, NULL, 0 },
 /* 0x87 */ { NULL, NULL, NULL, 0 },

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:21:52 UTC (rev 
24442)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:32:52 UTC (rev 
24443)
@@ -1149,7 +1149,7 @@
  Can be called from SMBsearch, SMBffirst or SMBfunique.
 /
 
-int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int 
dum_size, int dum_buffsize)
+void reply_search(connection_struct *conn, struct smb_request *req)
 {
pstring mask;
pstring directory;
@@ -1158,7 +1158,6 @@
uint32 mode;
time_t date;
uint32 dirtype;
-   int outsize = 0;
unsigned int numentries = 0;
unsigned int maxentries = 0;
BOOL finished = False;
@@ -1171,41 +1170,55 @@
BOOL expect_close = False;
NTSTATUS nt_status;
BOOL mask_contains_wcard = False;
-   BOOL allow_long_path_components = (SVAL(inbuf,smb_flg2)  
FLAGS2_LONG_PATH_COMPONENTS) ? True : False;
+   BOOL allow_long_path_components = (req-flags2  
FLAGS2_LONG_PATH_COMPONENTS) ? True : False;
 
START_PROFILE(SMBsearch);
 
+   if (req-wct  2) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBsearch);
+   return;
+   }
+
if (lp_posix_pathnames()) {
+   reply_unknown_new(req, CVAL(req-inbuf, smb_com));
END_PROFILE(SMBsearch);
-   return reply_unknown(inbuf, outbuf);
+   return;
}
 
*mask = *directory = *fname = 0;
 
/* If we were called as SMBffirst then we must expect close. */
-   if(CVAL(inbuf,smb_com) == SMBffirst) {
+   if(CVAL(req-inbuf,smb_com) == SMBffirst) {
expect_close = True;
}
-  
-   outsize = set_message(inbuf,outbuf,1,3,True);
-   maxentries = SVAL(inbuf,smb_vwv0); 
-   dirtype = SVAL(inbuf,smb_vwv1);
-   p = smb_buf(inbuf) + 1;
-   p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), path, p,
+
+   reply_outbuf(req, 1, 3);
+   maxentries = SVAL(req-inbuf,smb_vwv0);
+   dirtype = SVAL(req-inbuf,smb_vwv1);
+   p = smb_buf(req-inbuf) + 1;
+   p += srvstr_get_path_wcard((char *)req-inbuf, req-flags2, path, p,
   sizeof(path), 0, STR_TERMINATE, nt_status,
   mask_contains_wcard);
if (!NT_STATUS_IS_OK(nt_status)) {
+   reply_nterror(req, nt_status);
END_PROFILE(SMBsearch);
-   return ERROR_NT(nt_status);
+   return;
}
 
-   nt_status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2)  
FLAGS2_DFS_PATHNAMES, path, mask_contains_wcard);
+   nt_status = resolve_dfspath_wcard(conn,
+ req-flags2  FLAGS2_DFS_PATHNAMES,
+ path, mask_contains_wcard);
if (!NT_STATUS_IS_OK(nt_status)) {
-   END_PROFILE(SMBsearch);
if (NT_STATUS_EQUAL(nt_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);
+   END_PROFILE(SMBsearch);
+   return;
}
-   return ERROR_NT(nt_status);
+   reply_nterror(req, nt_status);
+   END_PROFILE(SMBsearch);
+   

svn commit: samba r24444 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread vlendec
Author: vlendec
Date: 2007-08-14 21:53:48 + (Tue, 14 Aug 2007)
New Revision: 2

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=2

Log:
Convert reply_find[n]close to the new API
Modified:
   branches/SAMBA_3_2/source/smbd/process.c
   branches/SAMBA_3_2/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/process.c
===
--- branches/SAMBA_3_2/source/smbd/process.c2007-08-14 21:32:52 UTC (rev 
24443)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-14 21:53:48 UTC (rev 
2)
@@ -742,8 +742,8 @@
 /* 0x31 */ { NULL, NULL, NULL, 0 },
 /* 0x32 */ { SMBtrans2, NULL,reply_trans2, AS_USER | CAN_IPC },
 /* 0x33 */ { SMBtranss2, NULL,reply_transs2, AS_USER},
-/* 0x34 */ { SMBfindclose, reply_findclose,NULL,AS_USER},
-/* 0x35 */ { SMBfindnclose, reply_findnclose,NULL, AS_USER},
+/* 0x34 */ { SMBfindclose, NULL,reply_findclose,AS_USER},
+/* 0x35 */ { SMBfindnclose, NULL,reply_findnclose,AS_USER},
 /* 0x36 */ { NULL, NULL, NULL, 0 },
 /* 0x37 */ { NULL, NULL, NULL, 0 },
 /* 0x38 */ { NULL, NULL, NULL, 0 },

Modified: branches/SAMBA_3_2/source/smbd/trans2.c
===
--- branches/SAMBA_3_2/source/smbd/trans2.c 2007-08-14 21:32:52 UTC (rev 
24443)
+++ branches/SAMBA_3_2/source/smbd/trans2.c 2007-08-14 21:53:48 UTC (rev 
2)
@@ -6816,37 +6816,49 @@
  Reply to a SMBfindclose (stop trans2 directory search).
 /
 
-int reply_findclose(connection_struct *conn,
-   char *inbuf,char *outbuf,int length,int bufsize)
+void reply_findclose(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
-   int dptr_num=SVALS(inbuf,smb_vwv0);
+   int dptr_num;
+
START_PROFILE(SMBfindclose);
 
+   if (req-wct  1) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBfindclose);
+   return;
+   }
+
+   dptr_num = SVALS(req-inbuf,smb_vwv0);
+
DEBUG(3,(reply_findclose, dptr_num = %d\n, dptr_num));
 
dptr_close(dptr_num);
 
-   outsize = set_message(inbuf, outbuf,0,0,False);
+   reply_outbuf(req, 0, 0);
 
DEBUG(3,(SMBfindclose dptr_num = %d\n, dptr_num));
 
END_PROFILE(SMBfindclose);
-   return(outsize);
+   return;
 }
 
 /
  Reply to a SMBfindnclose (stop FINDNOTIFYFIRST directory search).
 /
 
-int reply_findnclose(connection_struct *conn, 
-char *inbuf,char *outbuf,int length,int bufsize)
+void reply_findnclose(connection_struct *conn, struct smb_request *req)
 {
-   int outsize = 0;
-   int dptr_num= -1;
+   int dptr_num;
+
START_PROFILE(SMBfindnclose);
+
+   if (req-wct  1) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBfindnclose);
+   return;
+   }

-   dptr_num = SVAL(inbuf,smb_vwv0);
+   dptr_num = SVAL(req-inbuf,smb_vwv0);
 
DEBUG(3,(reply_findnclose, dptr_num = %d\n, dptr_num));
 
@@ -6854,12 +6866,12 @@
   findnotifyfirst - so any dptr_num is ok here. 
   Just ignore it. */
 
-   outsize = set_message(inbuf, outbuf,0,0,False);
+   reply_outbuf(req, 0, 0);
 
DEBUG(3,(SMB_findnclose dptr_num = %d\n, dptr_num));
 
END_PROFILE(SMBfindnclose);
-   return(outsize);
+   return;
 }
 
 static void handle_trans2(connection_struct *conn, struct smb_request *req,



Build status as of Wed Aug 15 00:00:02 2007

2007-08-14 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-08-14 
00:01:14.0 +
+++ /home/build/master/cache/broken_results.txt 2007-08-15 00:02:01.0 
+
@@ -1,24 +1,24 @@
-Build status as of Tue Aug 14 00:00:02 2007
+Build status as of Wed Aug 15 00:00:02 2007
 
 Build counts:
 Tree Total  Broken Panic 
 SOC  0  0  0 
 build_farm   0  0  0 
-ccache   29 7  0 
+ccache   30 8  0 
 ctdb 0  0  0 
 distcc   2  0  0 
-ldb  29 4  0 
-libreplace   28 7  0 
-lorikeet-heimdal 25 13 0 
+ldb  30 4  0 
+libreplace   29 8  0 
+lorikeet-heimdal 26 14 0 
 pidl 18 3  0 
 ppp  13 10 0 
 python   0  0  0 
-rsync30 10 0 
+rsync31 11 0 
 samba-docs   0  0  0 
 samba-gtk3  3  0 
-samba4   27 16 1 
-samba_3_231 18 0 
-smb-build27 27 0 
-talloc   30 1  0 
+samba4   28 17 1 
+samba_3_232 20 0 
+smb-build28 28 0 
+talloc   31 1  0 
 tdb  29 4  0 
 


svn commit: samba r24445 - in branches/SAMBA_3_2/source/smbd: .

2007-08-14 Thread jra
Author: jra
Date: 2007-08-15 01:54:37 + (Wed, 15 Aug 2007)
New Revision: 24445

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=24445

Log:
Convert SMBwritebraw. No test suite unfortunately I need to write one for 
this.
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-14 21:53:48 UTC (rev 
2)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-15 01:54:37 UTC (rev 
24445)
@@ -719,7 +719,7 @@
 /* 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},
+/* 0x1d */ { SMBwritebraw,NULL,reply_writebraw,AS_USER},
 /* 0x1e */ { SMBwriteBmpx,reply_writebmpx,NULL,AS_USER},
 /* 0x1f */ { SMBwriteBs,reply_writebs,NULL,AS_USER},
 /* 0x20 */ { SMBwritec,NULL, NULL,0},

Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-14 21:53:48 UTC (rev 
2)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-15 01:54:37 UTC (rev 
24445)
@@ -3259,11 +3259,27 @@
 }
 
 /
+ Error replies to writebraw must have smb_wct == 1. Fix this up.
+/
+
+void error_to_writebrawerr(struct smb_request *req)
+{
+   uint8 *old_outbuf = req-outbuf;
+
+   reply_outbuf(req, 1, 0);
+
+   memcpy(req-outbuf, old_outbuf, smb_size);
+   TALLOC_FREE(old_outbuf);
+}
+
+/
  Reply to a writebraw (core+ or LANMAN1.0 protocol).
 /
 
-int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int 
size, int dum_buffsize)
+void reply_writebraw(connection_struct *conn, struct smb_request *req)
 {
+   int outsize = 0;
+   char *buf = NULL;
ssize_t nwritten=0;
ssize_t total_written=0;
size_t numtowrite=0;
@@ -3271,140 +3287,212 @@
SMB_OFF_T startpos;
char *data=NULL;
BOOL write_through;
-   files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
-   int outsize = 0;
+   files_struct *fsp;
NTSTATUS status;
+
START_PROFILE(SMBwritebraw);
 
+   /*
+* If we ever reply with an error, it must have the SMB command
+* type of SMBwritec, not SMBwriteBraw, as this tells the client
+* we're finished.
+*/
+   SCVAL(req-inbuf,smb_com,SMBwritec);
+
if (srv_is_signing_active()) {
-   exit_server_cleanly(reply_writebraw: SMB signing is active - 
raw reads/writes are disallowed.);
+   END_PROFILE(SMBwritebraw);
+   exit_server_cleanly(reply_writebraw: SMB signing is active - 
+   raw reads/writes are disallowed.);
}
 
-   CHECK_FSP(fsp,conn);
+   if (req-wct  12) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   error_to_writebrawerr(req);
+   END_PROFILE(SMBwritebraw);
+   return;
+   }
+
+   fsp = file_fsp(SVAL(req-inbuf,smb_vwv0));
+   if (!check_fsp(conn, req, fsp, current_user)) {
+   error_to_writebrawerr(req);
+   END_PROFILE(SMBwritebraw);
+   return;
+   }
+
if (!CHECK_WRITE(fsp)) {
-   return(ERROR_DOS(ERRDOS,ERRbadaccess));
+   reply_doserror(req, ERRDOS, ERRbadaccess);
+   error_to_writebrawerr(req);
+   END_PROFILE(SMBwritebraw);
+   return;
}
-  
-   tcount = IVAL(inbuf,smb_vwv1);
-   startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv3);
-   write_through = BITSETW(inbuf+smb_vwv7,0);
 
+   tcount = IVAL(req-inbuf,smb_vwv1);
+   startpos = IVAL_TO_SMB_OFF_T(req-inbuf,smb_vwv3);
+   write_through = BITSETW(req-inbuf+smb_vwv7,0);
+
/* We have to deal with slightly different formats depending
on whether we are using the core+ or lanman1.0 protocol */
 
if(Protocol = PROTOCOL_COREPLUS) {
-   numtowrite = SVAL(smb_buf(inbuf),-2);
-   data = smb_buf(inbuf);
+   numtowrite = SVAL(smb_buf(req-inbuf),-2);
+   data = smb_buf(req-inbuf);
} else {
-   numtowrite = SVAL(inbuf,smb_vwv10);
-   data = smb_base(inbuf) + SVAL(inbuf, smb_vwv11);
+   numtowrite = SVAL(req-inbuf,smb_vwv10);
+   data = smb_base(req-inbuf) + SVAL(req-inbuf, smb_vwv11);
}
 
-   /* force 

Rev 588: merge changes needed for samba4 in http://samba.org/~tridge/ctdb

2007-08-14 Thread tridge

revno: 588
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Wed 2007-08-15 09:03:58 +1000
message:
  merge changes needed for samba4
modified:
  client/ctdb_client.c   ctdb_client.c-20070411010216-3kd8v37k61steeya-1
  include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11
=== modified file 'client/ctdb_client.c'
--- a/client/ctdb_client.c  2007-07-20 05:05:55 +
+++ b/client/ctdb_client.c  2007-08-14 23:03:58 +
@@ -637,6 +637,30 @@
return ctdb_ltdb_store(h-ctdb_db, h-key, h-header, data);
 }
 
+/*
+  non-locking fetch of a record
+ */
+int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
+  TDB_DATA key, TDB_DATA *data)
+{
+   struct ctdb_call call;
+   int ret;
+
+   call.call_id = CTDB_FETCH_FUNC;
+   call.call_data.dptr = NULL;
+   call.call_data.dsize = 0;
+
+   ret = ctdb_call(ctdb_db, call);
+
+   if (ret == 0) {
+   *data = call.reply_data;
+   talloc_steal(mem_ctx, data-dptr);
+   }
+
+   return ret;
+}
+
+
 struct ctdb_client_control_state {
struct ctdb_context *ctdb;
uint32_t reqid;
@@ -1432,6 +1456,11 @@
int ret;
int32_t res;
 
+   ctdb_db = ctdb_db_handle(ctdb, name);
+   if (ctdb_db) {
+   return ctdb_db;
+   }
+
ctdb_db = talloc_zero(ctdb, struct ctdb_db_context);
CTDB_NO_MEMORY_NULL(ctdb, ctdb_db);
 
@@ -2162,6 +2191,8 @@
ctdb-idr = idr_init(ctdb);
CTDB_NO_MEMORY_NULL(ctdb, ctdb-idr);
 
+   ctdb_set_socketname(ctdb, CTDB_PATH);
+
return ctdb;
 }
 

=== modified file 'include/ctdb.h'
--- a/include/ctdb.h2007-07-10 05:29:31 +
+++ b/include/ctdb.h2007-08-14 23:03:58 +
@@ -214,6 +214,9 @@
 
 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
 
+int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
+  TDB_DATA key, TDB_DATA *data);
+
 int ctdb_register_message_handler(struct ctdb_context *ctdb, 
  TALLOC_CTX *mem_ctx,
  uint64_t srvid,
@@ -367,4 +370,6 @@
   uint32_t destnode, 
   uint32_t set, uint32_t clear);
 
+int ctdb_socket_connect(struct ctdb_context *ctdb);
+
 #endif



Rev 589: merge from ronnie in http://samba.org/~tridge/ctdb

2007-08-14 Thread tridge

revno: 589
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Wed 2007-08-15 11:48:03 +1000
message:
  merge from ronnie
added:
  tests/rb_test.crb_test.c-20070808012115-zxl6646v2t2axezt-1
modified:
  Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1
  common/cmdline.c   cmdline.c-20070416041216-w1zvz91bkdsgjckw-1
  common/rb_tree.c   rb_tree.c-20070724085023-9r1nhv41taadrjde-1
  common/rb_tree.h   rb_tree.h-20070724085025-nboaewff1rsepopq-1
  server/ctdb_takeover.c 
ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
  tests/bench.sh bench.sh-20070209014602-vdolpr6esqsa58s7-1
  tools/ctdb.c   
ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
  utils/smnotify/smnotify.x  smnotify.x-20070803001844-k0ekeu031hzlt8bg-4
  web/nfs.html   nfs.html-20070608234340-a8i1dxro7a7i6jz6-1

revno: 432.1.195
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Wed 2007-08-15 07:59:01 +1000
message:
  from Chris Cowan
  patches to smnotify to make it compile under AIX.
  
  On AIX, we need to specify $(POPT_OBJ) explicitely
  
  On AIX we can not use the -C flag to rpcgen since it is not implemented
  
  On AIX we must explicitely force an #include of rpc/rpc.h in the idl 
  file since rpcgen does not automatically add it to the generated files

revno: 432.1.194
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Mon 2007-08-13 14:29:19 +1000
message:
  enhanced tests to verify the tree integrity when adding/removing nodes

revno: 432.1.193
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Thu 2007-08-09 16:11:11 +1000
message:
  remove an extra blankline

revno: 432.1.192
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Thu 2007-08-09 14:08:59 +1000
message:
  change the mem hierarchy for trees.   let the node be owned by the data 
  we store in the tree and use a node destructor so that when the data is 
  talloc_free()d we also remove the node from the tree.

revno: 432.1.191
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Thu 2007-08-09 07:59:50 +1000
message:
  remove an unused function

revno: 432.1.190
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Wed 2007-08-08 17:49:08 +1000
message:
  run the test for 60 seconds if that is what we claim

revno: 432.1.189
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Wed 2007-08-08 17:26:40 +1000
message:
  add more extensive test cases  and verify that we are not losing any 
  memory inside the tree

revno: 432.1.188
merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie Sahlberg [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Wed 2007-08-08 15:09:19 +1000
message:
  when we want to kill a tcp connection  we stored the connection 
  description (src + dst sockaddr_in) in a linked list.
  everytime we receive a captured packet from the network we had to walk 
  this list in linear time to see if the packet matched a connection we 
  wanted to RST.
  which wouldnt scale very well.
  
  
  replace the linked list with a redblack tree that is indexed by
  src address, src port,  dst address,   dst port
  to make checking whether the packet belongs to a connection we want to 
  RST very fast and scalable
  
  
  the reason we need to capture packets when we want to kill a TCP 
  connection is because we must wait for an ACK coming back from the 
  remote host  so that we can learn