svn commit: samba r8733 - in trunk/source/smbd: .

2005-07-24 Thread vlendec
Author: vlendec
Date: 2005-07-24 08:35:31 + (Sun, 24 Jul 2005)
New Revision: 8733

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

Log:
Reformatting
Modified:
   trunk/source/smbd/reply.c


Changeset:
Modified: trunk/source/smbd/reply.c
===
--- trunk/source/smbd/reply.c   2005-07-24 04:42:38 UTC (rev 8732)
+++ trunk/source/smbd/reply.c   2005-07-24 08:35:31 UTC (rev 8733)
@@ -5047,7 +5047,8 @@
  Reply to a lockingX request.
 /
 
-int reply_lockingX(connection_struct *conn, char *inbuf,char *outbuf,int 
length,int bufsize)
+int reply_lockingX(connection_struct *conn, char *inbuf, char *outbuf,
+  int length, int bufsize)
 {
files_struct *fsp = file_fsp(inbuf,smb_vwv2);
unsigned char locktype = CVAL(inbuf,smb_vwv3);
@@ -5059,7 +5060,8 @@
int32 lock_timeout = IVAL(inbuf,smb_vwv4);
int i;
char *data;
-   BOOL large_file_format = (locktype  
LOCKING_ANDX_LARGE_FILES)?True:False;
+   BOOL large_file_format =
+   (locktype  LOCKING_ANDX_LARGE_FILES)?True:False;
BOOL err;
BOOL my_lock_ctx = False;
NTSTATUS status;
@@ -5089,19 +5091,24 @@
/* Client can insist on breaking to none. */
BOOL break_to_none = (oplocklevel == 0);
BOOL result;
-   
-   DEBUG(5,(reply_lockingX: oplock break reply (%u) from client 
for fnum = %d\n,
-(unsigned int)oplocklevel, fsp-fnum ));
 
+   DEBUG(5,(reply_lockingX: oplock break reply (%u) from client 
+for fnum = %d\n, (unsigned int)oplocklevel,
+fsp-fnum ));
+
/*
-* Make sure we have granted an exclusive or batch oplock on 
this file.
+* Make sure we have granted an exclusive or batch oplock on
+* this file.
 */

if (fsp-oplock_type == 0) {
-   DEBUG(0,(reply_lockingX: Error : oplock break from 
client for fnum = %d (oplock=%d) and \
-no oplock granted on this file (%s).\n, fsp-fnum, fsp-oplock_type, 
fsp-fsp_name));
+   DEBUG(0,(reply_lockingX: Error : oplock break from 
+client for fnum = %d (oplock=%d) and no 
+oplock granted on this file (%s).\n,
+fsp-fnum, fsp-oplock_type, fsp-fsp_name));
 
-   /* if this is a pure oplock break request then don't 
send a reply */
+   /* if this is a pure oplock break request then don't
+* send a reply */
if (num_locks == 0  num_ulocks == 0) {
END_PROFILE(SMBlockingX);
return -1;
@@ -5127,12 +5134,14 @@
 
reply_to_oplock_break_requests(fsp);
 
-   /* if this is a pure oplock break request then don't send a 
reply */
+   /* if this is a pure oplock break request then don't send a
+* reply */
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)
-   DEBUG(0,(reply_lockingX: Error : pure oplock 
break is a chained %d request !\n,
+   DEBUG(0,(reply_lockingX: Error : pure oplock 
+break is a chained %d request !\n,
 (unsigned int)CVAL(inbuf,smb_vwv0) ));
END_PROFILE(SMBlockingX);
return -1;
@@ -5161,8 +5170,9 @@
return ERROR_DOS(ERRDOS,ERRnoaccess);
}
 
-   DEBUG(10,(reply_lockingX: unlock start=%.0f, len=%.0f for pid 
%u, file %s\n,
- (double)offset, (double)count, (unsigned 
int)lock_pid, fsp-fsp_name ));
+   DEBUG(10,(reply_lockingX: unlock start=%.0f, len=%.0f for 
+ pid %u, file %s\n, (double)offset, (double)count,
+ (unsigned int)lock_pid, fsp-fsp_name ));

status = do_unlock(fsp,conn,lock_pid,count,offset);
if (NT_STATUS_V(status)) {
@@ -5194,27 +5204,34 @@
return ERROR_DOS(ERRDOS,ERRnoaccess);
}

-   DEBUG(10,(reply_lockingX: lock start=%.0f, len=%.0f for pid 
%u, file %s timeout = %d\n,
-   (double)offset, (double)count, (unsigned int)lock_pid,
-   fsp-fsp_name, (int)lock_timeout ));
+   DEBUG(10,(reply_lockingX: 

svn commit: lorikeet r381 - in trunk/sangria/src: .

2005-07-24 Thread amit
Author: amit
Date: 2005-07-24 09:33:08 + (Sun, 24 Jul 2005)
New Revision: 381

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

Log:
amit regmi
Modified:
   trunk/sangria/src/make_smb_conf.py
   trunk/sangria/src/smb_tools.py


Changeset:
Modified: trunk/sangria/src/make_smb_conf.py
===
--- trunk/sangria/src/make_smb_conf.py  2005-07-23 09:43:19 UTC (rev 380)
+++ trunk/sangria/src/make_smb_conf.py  2005-07-24 09:33:08 UTC (rev 381)
@@ -407,6 +407,11 @@
 print  the share is already there 
 
 def SetPathOfShare(self, shareName , pathOfShare, serverObject):
+''' set the path and include the basic permissions
+like ...
+read-only = yes
+browesable  = yes
+'''
 x = serverObject
 # check if the path exists ... If it does not ... create .. it
if( not os.path.isdir(pathOfShare)):
@@ -420,7 +425,9 @@
 x.AddService(shareToAdd , ['##','## added by modify.py ','##'])
 x.SetServiceOption(shareName , path , pathOfShare)
 x.SetServiceOption(shareName , comment ,no comment)
-x.SetServiceOption(shareName , read only ,no) 
+x.SetServiceOption(shareName , read only ,no)
+x.SetServiceOption(shareName , browesable ,yes)
+
 
 def deleteShare(self, shareToDelete , serverObject):
 ''' here we delete the share if present already in the smb.conf file 
'''

Modified: trunk/sangria/src/smb_tools.py
===
--- trunk/sangria/src/smb_tools.py  2005-07-23 09:43:19 UTC (rev 380)
+++ trunk/sangria/src/smb_tools.py  2005-07-24 09:33:08 UTC (rev 381)
@@ -49,11 +49,47 @@

 return return_str
 
+def listUnixUserAccountsInPasswd(self , pathOfPasswdFile ):
+'''
+returns a LIST of the Unix user names
+returns 0 on failure
+returns -1 on Access Denied
+'''
+
+splitted_output1 = []
+return_list1 = []
 
+if (self.Am_I_Root()):
+cmd1 = cat %s %pathOfPasswdFile
+( status1, cmd_output1 ) = commands.getstatusoutput( cmd1 )
+if status1:
+print  system error \n
+print cmd_output1
+return 0
+
+else:
+# the output obtained is a string as a whole
+splitted_output1 = string.split(cmd_output1,'\n')
+for line1 in splitted_output1:
+# again split and chuck out the first split ...
+temp1 = string.split(line1 , :)
+return_list1.append(temp1[0])
+#print temp1[0]
+
+return return_list1
+
+else:
+print  You don't have root access 
+return -1
+
+
+
 def listUserAccountsInSmbpasswd(self):
-''' returns a LIST of the user names on
-0 on failure and
 '''
+returns a LIST of the user names on Samba
+returns 0 on failure
+returns -1 on Access Denied
+'''
 
 splitted_output1 = []
 return_list1 = []
@@ -79,6 +115,7 @@
 
 else:
 print  You don't have root access 
+return -1
 
   
 
@@ -101,6 +138,7 @@
 
 else:
 print  You don't have root access 
+return -1
 
 
 def serverRefresh(self):
@@ -120,6 +158,7 @@
 return 1
 else:
 print  You don't have root access 
+return -1
 
 def SMBmountPath(self, mountSourcePath , mountDestPath , loginName , 
loginPassword):
 ''' mount a given path to a location mentioned ..
@@ -140,6 +179,7 @@
 
 else:
 print  You don't have root access 
+return -1
 
 
 def SMBumountPath(self, umountPath ):
@@ -161,8 +201,72 @@
 
 else:
 print  You don't have root access 
+return -1
 
+def addSambaAccount( self, SMBaccountID , SMBpassword ):
+
+''' it is assumed that the SMBaccountID is already there as a Unix 
User account
+here we also update the smbpasswd database so as to include each 
unix users
+as a potential accounts for samba'''
+if (self.Am_I_Root()):
 
+cmd3 = cat /etc/passwd | /usr/bin/mksmbpasswd.sh  
/etc/samba/smbpasswd
+( status3, cmd_output3 ) = commands.getstatusoutput( cmd3 )
+if status3:
+print cmd_output3
+else:
+print  /etc/samba/smbpasswd updated successfully 
+
+cmd3 = smbpasswd %s %s %(SMBaccountID, SMBpassword)
+ 

svn commit: samba r8734 - in branches/SAMBA_4_0/source/nbt_server/wins: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-24 12:18:11 + (Sun, 24 Jul 2005)
New Revision: 8734

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

Log:
fixed the wins server for the new ldb DN restrictions.

This gets it working, but I'm rather worried about the speed. We used
to get more than 5000 ops/sec, but now we are down to around 15
ops/sec. I suspect a bug in ldb.

Modified:
   branches/SAMBA_4_0/source/nbt_server/wins/winsdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/nbt_server/wins/winsdb.c
===
--- branches/SAMBA_4_0/source/nbt_server/wins/winsdb.c  2005-07-24 08:35:31 UTC 
(rev 8733)
+++ branches/SAMBA_4_0/source/nbt_server/wins/winsdb.c  2005-07-24 12:18:11 UTC 
(rev 8734)
@@ -83,7 +83,32 @@
}
 }
 
+
 /*
+  return a DN for a nbt_name
+*/
+static char *winsdb_dn(TALLOC_CTX *mem_ctx, struct nbt_name *name)
+{
+   char *ret = talloc_asprintf(mem_ctx, type=%02x, name-type);
+   if (ret == NULL) {
+   return ret;
+   }
+   if (name-name  *name-name) {
+   ret = talloc_asprintf_append(ret, ,name=%s, name-name);
+   }
+   if (ret == NULL) {
+   return ret;
+   }
+   if (name-scope  *name-scope) {
+   ret = talloc_asprintf_append(ret, ,scope=%s, name-scope);
+   }
+   if (ret == NULL) {
+   return ret;
+   }
+   return ret;
+}
+
+/*
   load a WINS entry from the database
 */
 struct winsdb_record *winsdb_load(struct wins_server *winssrv, 
@@ -97,7 +122,7 @@
const char *expr;
int i;
 
-   expr = talloc_asprintf(tmp_ctx, dn=NAME=%s, nbt_name_string(tmp_ctx, 
name));
+   expr = talloc_asprintf(tmp_ctx, dn=%s, winsdb_dn(tmp_ctx, name));
if (expr == NULL) goto failed;
 
/* find the record in the WINS database */
@@ -159,8 +184,9 @@
struct ldb_message *msg = ldb_msg_new(mem_ctx);
if (msg == NULL) goto failed;
 
-   msg-dn = talloc_asprintf(msg, NAME=%s, nbt_name_string(msg, 
rec-name));
+   msg-dn = winsdb_dn(msg, rec-name);
if (msg-dn == NULL) goto failed;
+   ret |= ldb_msg_add_fmt(ldb, msg, objectClass, wins);
ret |= ldb_msg_add_fmt(ldb, msg, active, %u, rec-state);
ret |= ldb_msg_add_fmt(ldb, msg, nbFlags, 0x%04x, rec-nb_flags);
ret |= ldb_msg_add_string(ldb, msg, registeredBy, rec-registered_by);
@@ -250,7 +276,7 @@
 
winsdb_remove_version(winssrv, rec-version);
 
-   dn = talloc_asprintf(tmp_ctx, NAME=%s, nbt_name_string(tmp_ctx, 
rec-name));
+   dn = winsdb_dn(tmp_ctx, rec-name);
if (dn == NULL) goto failed;
 
ret = ldb_delete(ldb, dn);



svn commit: samba r8735 - in branches/SAMBA_4_0/source/script/tests: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-24 12:24:34 + (Sun, 24 Jul 2005)
New Revision: 8735

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

Log:
added NBT and WINS testing to 'make test' so we will know if it breaks again

Added:
   branches/SAMBA_4_0/source/script/tests/test_nbt.sh
Modified:
   branches/SAMBA_4_0/source/script/tests/selftest.sh
   branches/SAMBA_4_0/source/script/tests/tests_all.sh
   branches/SAMBA_4_0/source/script/tests/tests_quick.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/selftest.sh
===
--- branches/SAMBA_4_0/source/script/tests/selftest.sh  2005-07-24 12:18:11 UTC 
(rev 8734)
+++ branches/SAMBA_4_0/source/script/tests/selftest.sh  2005-07-24 12:24:34 UTC 
(rev 8735)
@@ -93,6 +93,7 @@
interfaces = lo*
tls enabled = $TLS_ENABLED
panic action = $SRCDIR/script/gdb_backtrace %PID% %PROG%
+   wins support = yes
 
 [tmp]
path = $TMPDIR

Added: branches/SAMBA_4_0/source/script/tests/test_nbt.sh
===
--- branches/SAMBA_4_0/source/script/tests/test_nbt.sh  2005-07-24 12:18:11 UTC 
(rev 8734)
+++ branches/SAMBA_4_0/source/script/tests/test_nbt.sh  2005-07-24 12:24:34 UTC 
(rev 8735)
@@ -0,0 +1,23 @@
+#!/bin/sh
+# test some NBT/WINS operations
+
+if [ $# -lt 1 ]; then
+cat EOF
+Usage: test_nbt.sh SERVER
+EOF
+exit 1;
+fi
+
+SERVER=$1
+
+incdir=`dirname $0`
+. $incdir/test_functions.sh
+
+SCRIPTDIR=../testprogs/ejs
+
+PATH=bin:$PATH
+export PATH
+
+for f in NBT-REGISTER NBT-WINS; do
+testit $f bin/smbtorture $TORTURE_OPTIONS //$SERVER/_none_ $f || 
failed=`expr $failed + 1`
+done


Property changes on: branches/SAMBA_4_0/source/script/tests/test_nbt.sh
___
Name: svn:executable
   + *

Modified: branches/SAMBA_4_0/source/script/tests/tests_all.sh
===
--- branches/SAMBA_4_0/source/script/tests/tests_all.sh 2005-07-24 12:18:11 UTC 
(rev 8734)
+++ branches/SAMBA_4_0/source/script/tests/tests_all.sh 2005-07-24 12:24:34 UTC 
(rev 8735)
@@ -1,5 +1,6 @@
  $SRCDIR/script/tests/test_ejs.sh localhost $USERNAME $PASSWORD || 
failed=`expr $failed + $?`
  $SRCDIR/script/tests/test_ldap.sh localhost $USERNAME $PASSWORD || 
failed=`expr $failed + $?`
+ $SRCDIR/script/tests/test_nbt.sh localhost || failed=`expr $failed + $?`
  $SRCDIR/script/tests/test_quick.sh //localhost/cifs $USERNAME $PASSWORD  || 
failed=`expr $failed + $?`
  $SRCDIR/script/tests/test_rpc.sh localhost $USERNAME $PASSWORD $DOMAIN || 
failed=`expr $failed + $?`
  $SRCDIR/script/tests/test_session_key.sh localhost $USERNAME $PASSWORD 
$DOMAIN || failed=`expr $failed + $?`

Modified: branches/SAMBA_4_0/source/script/tests/tests_quick.sh
===
--- branches/SAMBA_4_0/source/script/tests/tests_quick.sh   2005-07-24 
12:18:11 UTC (rev 8734)
+++ branches/SAMBA_4_0/source/script/tests/tests_quick.sh   2005-07-24 
12:24:34 UTC (rev 8735)
@@ -1,3 +1,5 @@
 $SRCDIR/script/tests/test_ejs.sh localhost $USERNAME $PASSWORD || failed=`expr 
$failed + $?`
 $SRCDIR/script/tests/test_ldap.sh localhost $USERNAME $PASSWORD || 
failed=`expr $failed + $?`
+$SRCDIR/script/tests/test_nbt.sh localhost || failed=`expr $failed + $?`
 $SRCDIR/script/tests/test_quick.sh //localhost/cifs $USERNAME $PASSWORD  || 
failed=`expr $failed + $?`
+



svn commit: samba r8736 - in branches/SAMBA_4_0/source/lib/ldb/ldb_tdb: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-24 12:38:42 + (Sun, 24 Jul 2005)
New Revision: 8736

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

Log:
this fixes the ldb speed (raises BENCH-WINS from 15 ops/sec to over 4000)

simo, we need to be careful to cope with this sort of direct dn query 
efficiently


Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c
===
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c  2005-07-24 
12:24:34 UTC (rev 8735)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c  2005-07-24 
12:38:42 UTC (rev 8736)
@@ -461,6 +461,13 @@
struct ltdb_private *ltdb = module-private_data;
int ret;
 
+   /* it is important that we handle dn queries this way, and not
+  via a full db search, otherwise ldb is horribly slow */
+   if (tree-operation == LDB_OP_EQUALITY 
+   ldb_attr_cmp(tree-u.equality.attr, dn) == 0) {
+   return ltdb_search_dn(module, tree-u.equality.value.data, 
attrs, res);
+   }
+
if (ltdb_lock_read(module) != 0) {
return -1;
}



svn commit: samba r8737 - in trunk/source: include locking smbd

2005-07-24 Thread vlendec
Author: vlendec
Date: 2005-07-24 13:25:16 + (Sun, 24 Jul 2005)
New Revision: 8737

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

Log:
Some changes to the new oplock code:

Don't store in the share mode db that we're waiting for a break, the receiving
daemon remembers a list of clients. Thus in delay_for_oplocks we don't need a
lock on the share mode db, we don't change anything.

Moved the returning the sharing violation return down to where it actually
would be returned, querying the variable second_try. Timeouts don't always
mean sharing violations. I need to find out how to correctly handle oplock
break failures next. More work in the samba4 oplock test.

Immediately reply to unexpected oplock requests to avoid races.

Volker


Modified:
   trunk/source/include/smb.h
   trunk/source/locking/locking.c
   trunk/source/smbd/open.c
   trunk/source/smbd/oplock.c


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


svn commit: samba r8738 - in branches/SAMBA_4_0/testprogs/ejs: .

2005-07-24 Thread abartlet
Author: abartlet
Date: 2005-07-24 22:18:01 + (Sun, 24 Jul 2005)
New Revision: 8738

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

Log:
Test (using ejs!) the basic operation of the ldb modules.

ejs seems to test this stuff very nicely!

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/testprogs/ejs/ldb.js


Changeset:
Modified: branches/SAMBA_4_0/testprogs/ejs/ldb.js
===
--- branches/SAMBA_4_0/testprogs/ejs/ldb.js 2005-07-24 13:25:16 UTC (rev 
8737)
+++ branches/SAMBA_4_0/testprogs/ejs/ldb.js 2005-07-24 22:18:01 UTC (rev 
8738)
@@ -6,7 +6,7 @@
 
 
 var ldb = ldb_init();
-
+var sys;
 function basic_tests(ldb)
 {
println(Running basic tests);
@@ -53,16 +53,72 @@
res = ldb.search(x=7);
assert(res.length == 1);
assert(res[0].x.length == 2);
+
+   /* Check a few things before we add modules */
+   assert(res[0].objectGUID == undefined);
+   assert(res[0].createTimestamp == undefined);
+   assert(res[0].whenCreated == undefined);
+
+}

+function setup_modules(ldb)
+{
+   ok = ldb.add(
+dn: @MODULES
[EMAIL PROTECTED]: timestamps,objectguid,rdn_name
+);
 }
 
-sys_init(ldb);
+/* Test the basic operation of the timestamps,objectguid and name_rdn
+   modules */
+
+function modules_test(ldb) 
+{
+println(Running modules tests);
+   ok = ldb.add(
+dn: cn=x8,cn=test
+objectClass: foo
+x: 8
+);
+   assert(ok);
+
+   ok = ldb.add(
+dn: cn=x9,cn=test
+objectClass: foo
+x: 9
+);
+   assert(ok);
+
+   var res = ldb.search(x=8, NULL, ldb.SCOPE_DEFAULT);
+   assert(res[0].objectGUID != undefined);
+   assert(res[0].createTimestamp != undefined);
+   assert(res[0].whenCreated != undefined);
+   assert(res[0].name == x8);
+
+   var res2 = ldb.search(x=9, NULL, ldb.SCOPE_DEFAULT);
+   assert(res2[0].objectGUID != undefined);
+   assert(res2[0].createTimestamp != undefined);
+   assert(res2[0].whenCreated != undefined);
+   assert(res2[0].name == x9);
+
+   assert(res[0].objectGUID != res2[0].objectGUID);
+
+}
+
+sys = sys_init();
 var dbfile = test.ldb;
-ldb.unlink(dbfile);
+sys.unlink(dbfile);
 var ok = ldb.connect(tdb:// + dbfile);
 assert(ok);
 
 basic_tests(ldb);
 
-ldb.unlink(dbfile);
+setup_modules(ldb);
+ldb = ldb_init();
+var ok = ldb.connect(tdb:// + dbfile);
+assert(ok);
+
+modules_test(ldb);
+
+sys.unlink(dbfile);
 return 0;



svn commit: samba r8739 - in branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture: . rpc

2005-07-24 Thread brad
Author: brad
Date: 2005-07-24 22:24:46 + (Sun, 24 Jul 2005)
New Revision: 8739

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

Log:
added a test called RPC-DSSYNC to config.mk
hacking at dssync.c in an attempt to make it compile
Modified:
   branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/config.mk
   branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/rpc/dssync.c
   branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/torture.c


Changeset:
Modified: branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/config.mk
===
--- branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/config.mk   2005-07-24 
22:18:01 UTC (rev 8738)
+++ branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/config.mk   2005-07-24 
22:24:46 UTC (rev 8739)
@@ -71,6 +71,7 @@
 # Start SUBSYSTEM TORTURE_RPC
 [SUBSYSTEM::TORTURE_RPC]
 ADD_OBJ_FILES = \
+   torture/rpc/dssync.o \
torture/rpc/lsa.o \
torture/rpc/session_key.o \
torture/rpc/echo.o \

Modified: branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/rpc/dssync.c
===
--- branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/rpc/dssync.c
2005-07-24 22:18:01 UTC (rev 8738)
+++ branches/SOC/SAMBA_4_0/SAMBA_4_0/source/torture/rpc/dssync.c
2005-07-24 22:24:46 UTC (rev 8739)
@@ -127,30 +127,42 @@
 {
{
const char *ldif;
-   struct ldap_message *req, *rep;
-
+   struct ldap_message *req; //, *rep;
+   NTSTATUS rtn;
+   BOOL rtn_status = False;
+   
ldif = talloc_asprintf(ctx,
dn: %s\n
changetype: delete\n,
ctx-new_dc.dc_info2.ntds_dn);
-
-   req = ldap_ldif2msg(ctx, ldif);
-
-   rep = ldap_transaction(ctx-admin.ldap.conn, req);
+   
+   //req = ldap_ldif2msg(ctx, ldif);
+   //req.messageid = ;
+   req-type = LDAP_TAG_DelRequest;
+   req-r.DelRequest.dn = ctx-new_dc.dc_info2.ntds_dn;
+   //req.num_controls = ;
+   //req.controls = ;
+   
+   
+   
+   rtn = ldap_transaction(ctx-admin.ldap.conn, req);
}
 
{
const char *ldif;
-   struct ldap_message *req, *rep;
-
+   struct ldap_message *req; //, *rep;
+   NTSTATUS rtn;
+   
ldif = talloc_asprintf(ctx,
dn: %s\n
changetype: delete\n,
ctx-new_dc.dc_info2.server_dn);
 
-   req = ldap_ldif2msg(ctx, ldif);
+   //req = ldap_ldif2msg(ctx, ldif);
+   req-type = LDAP_TAG_DelRequest;
+   req-r.DelRequest.dn = ctx-new_dc.dc_info2.ntds_dn;
 
-   rep = ldap_transaction(ctx-admin.ldap.conn, req);
+   rtn = ldap_transaction(ctx-admin.ldap.conn, req);
}
 
if (ctx-new_dc.join) {
@@ -164,12 +176,13 @@
 {
NTSTATUS status;
BOOL ret = True;
+   struct event_context *event;
 
status = dcerpc_pipe_connect_b(ctx,
   b-pipe, ctx-drsuapi_binding, 
   DCERPC_DRSUAPI_UUID,
   DCERPC_DRSUAPI_VERSION,
-  credentials);
+  credentials, event);

if (!NT_STATUS_IS_OK(status)) {
printf(Failed to connect to server as a BDC: %s\n, 
nt_errstr(status));
@@ -290,9 +303,10 @@
 {
NTSTATUS status;
const char *ldif;
-   struct ldap_message *req,*rep;
+   struct ldap_message *req; //,*rep;
BOOL ret = True;
-
+   NTSTATUS rtn;
+   
/* userAccountControl: 532480 0x82000 
 * UF_SERVER_TRUST_ACCOUNT|UF_TRUSTED_FOR_DELEGATION
 */
@@ -304,10 +318,21 @@
ctx-new_dc.dc_info2.computer_dn,
UF_SERVER_TRUST_ACCOUNT|UF_TRUSTED_FOR_DELEGATION);
 
-   req = ldap_ldif2msg(ctx, ldif);
+   //req = ldap_ldif2msg(ctx, ldif);
+   req-type = LDAP_TAG_ModifyRequest;
+   req-r.ModifyRequest.dn = ctx-new_dc.dc_info2.computer_dn;
+   req-r.ModifyRequest.num_mods = 1;
+   req-r.ModifyRequest.mods-type = LDAP_MODIFY_REPLACE;
+   req-r.ModifyRequest.mods-attrib.flags = LDB_FLAG_MOD_REPLACE;
+   req-r.ModifyRequest.mods-attrib.name = userAccountControl;
+   req-r.ModifyRequest.mods-attrib.num_values = 1;
+   req-r.ModifyRequest.mods-attrib.values-data = 
UF_SERVER_TRUST_ACCOUNT|UF_TRUSTED_FOR_DELEGATION;
+   req-r.ModifyRequest.mods-attrib.values-length = 
sizeof(req-r.ModifyRequest.mods-attrib.values-data);
+   
+// = UF_SERVER_TRUST_ACCOUNT|UF_TRUSTED_FOR_DELEGATION;
+ 

Build status as of Mon Jul 25 00:00:02 2005

2005-07-24 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2005-07-24 
00:00:07.0 +
+++ /home/build/master/cache/broken_results.txt 2005-07-25 00:00:18.0 
+
@@ -1,16 +1,16 @@
-Build status as of Sun Jul 24 00:00:02 2005
+Build status as of Mon Jul 25 00:00:02 2005
 
 Build counts:
 Tree Total  Broken Panic 
 ccache   34 7  0 
 distcc   34 5  0 
-lorikeet-heimdal 25 11 0 
-ppp  19 2  0 
+lorikeet-heimdal 23 10 0 
+ppp  20 2  0 
 rsync33 2  0 
 samba-docs   0  0  0 
-samba4   35 13 0 
-samba_3_034 8  0 
-smb-build29 4  0 
-talloc   33 13 0 
-tdb  33 15 0 
+samba4   36 13 0 
+samba_3_034 4  0 
+smb-build30 4  0 
+talloc   33 12 0 
+tdb  33 12 0 
 


svn commit: samba r8740 - in branches/SAMBA_4_0: source/dsdb/samdb/ldb_modules source/lib/ldb/modules source/setup testprogs/ejs

2005-07-24 Thread abartlet
Author: abartlet
Date: 2005-07-25 01:17:09 + (Mon, 25 Jul 2005)
New Revision: 8740

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

Log:
Extend the rdn_name module to handle adding the rdn as an attribute.  ie:

dn: cn=foo,ou=bar
objectClass: person

implies

dn: cn=foo,ou=bar
objectClass: person
cn: foo
(as well as a pile more default attributes)

We also correct the case in the attirbute to match that in the DN
(win2k3 behaviour) and I have a testsuite (in ejs) to prove it.

This module also found a bug in our provision.ldif, so and reduces
code complexity in the samdb module.

Andrew Bartlett


Added:
   branches/SAMBA_4_0/testprogs/ejs/ldap.js
Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/samldb.c
   branches/SAMBA_4_0/source/lib/ldb/modules/rdn_name.c
   branches/SAMBA_4_0/source/setup/provision.ldif
   branches/SAMBA_4_0/testprogs/ejs/ldb.js


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/samldb.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/samldb.c   2005-07-24 
22:24:46 UTC (rev 8739)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/samldb.c   2005-07-25 
01:17:09 UTC (rev 8740)
@@ -410,17 +410,6 @@
return NULL;
}
 
-   if ((attribute = samldb_find_attribute(msg2, cn, NULL)) != NULL) {
-   if (strcasecmp(rdn-value.data, attribute-values[0].data) != 
0) {
-   ldb_debug(module-ldb, LDB_DEBUG_FATAL, 
samldb_fill_group_object: Bad Attribute Syntax for CN\n);
-   return NULL;
-   }
-   } else { /* FIXME: remove this if ldb supports natively aliasing 
between the rdn and the cn attribute */
-   if ( ldb_msg_add_value(module-ldb, msg2, cn, rdn-value)) {
-   return NULL;
-   }
-   }
-
if ((attribute = samldb_find_attribute(msg2, objectSid, NULL)) == 
NULL ) {
struct dom_sid *sid = samldb_get_new_sid(module, msg2, 
msg2-dn);
if (sid == NULL) {
@@ -481,7 +470,7 @@
return NULL;
}
if (strcasecmp(rdn-name, cn) != 0) {
-   ldb_debug(module-ldb, LDB_DEBUG_FATAL, 
samldb_fill_user_or_computer_object: Bad RDN (%s) for group!\n, rdn-name);
+   ldb_debug(module-ldb, LDB_DEBUG_FATAL, 
samldb_fill_user_or_computer_object: Bad RDN (%s) for user/computer!\n, 
rdn-name);
return NULL;
}
 
@@ -490,17 +479,6 @@
return NULL;
}
 
-   if ((attribute = samldb_find_attribute(msg2, cn, NULL)) != NULL) {
-   if (strcasecmp(rdn-value.data, attribute-values[0].data) != 
0) {
-   ldb_debug(module-ldb, LDB_DEBUG_FATAL, 
samldb_fill_group_object: Bad Attribute Syntax for CN\n);
-   return NULL;
-   }
-   } else { /* FIXME: remove this if ldb supports natively aliasing 
between the rdn and the cn attribute */
-   if ( ldb_msg_add_value(module-ldb, msg2, cn, rdn-value)) {
-   return NULL;
-   }
-   }
-
if ((attribute = samldb_find_attribute(msg2, objectSid, NULL)) == 
NULL ) {
struct dom_sid *sid;
sid = samldb_get_new_sid(module, msg2, msg2-dn);

Modified: branches/SAMBA_4_0/source/lib/ldb/modules/rdn_name.c
===
--- branches/SAMBA_4_0/source/lib/ldb/modules/rdn_name.c2005-07-24 
22:24:46 UTC (rev 8739)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/rdn_name.c2005-07-25 
01:17:09 UTC (rev 8740)
@@ -88,10 +88,12 @@
 /* add_record: add crateTimestamp/modifyTimestamp attributes */
 static int rdn_name_add_record(struct ldb_module *module, const struct 
ldb_message *msg)
 {
+   struct private_data *data = (struct private_data *)module-private_data;
+
struct ldb_message *msg2;
struct ldb_message_element *attribute;
struct ldb_dn_component *rdn;
-   int ret, i;
+   int i, ret;
 
ldb_debug(module-ldb, LDB_DEBUG_TRACE, rdn_name_add_record\n);
 
@@ -126,6 +128,29 @@
return -1;
}
 
+   attribute = rdn_name_find_attribute(msg2, rdn-name);
+
+   if (!attribute) {
+   if (ldb_msg_add_value(module-ldb, msg2, rdn-name, 
rdn-value) != 0) {
+   return -1;
+   }
+   } else {
+   const struct ldb_attrib_handler *handler
+   = ldb_attrib_handler(module-ldb, rdn-name);
+   for (i=0; i  attribute-num_values; i++) {
+   if (handler-comparison_fn(module-ldb, msg2, 
rdn-value, attribute-values[i]) == 0) {
+   /* overwrite so it matches in case */
+   attribute-values[i] = rdn-value;
+   break;
+   }
+  

svn commit: samba r8741 - in branches/SAMBA_4_0/source/libnet: .

2005-07-24 Thread abartlet
Author: abartlet
Date: 2005-07-25 01:19:16 + (Mon, 25 Jul 2005)
New Revision: 8741

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

Log:
Kill warnings about enums not fully enumerated, as we will never use
all the branches.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/libnet/libnet_vampire.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_vampire.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_vampire.c   2005-07-25 01:17:09 UTC 
(rev 8740)
+++ branches/SAMBA_4_0/source/libnet/libnet_vampire.c   2005-07-25 01:19:16 UTC 
(rev 8741)
@@ -158,6 +158,8 @@
   error_string);
break;
}
+   default:
+   break;
}
return nt_status;
 }
@@ -395,6 +397,9 @@
  delta);
break;
}
+   default:
+   /* Can't dump them all right now */
+   break;
}
return nt_status;
 }



svn commit: samba r8742 - in branches/SAMBA_4_0/source/scripting/ejs: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 02:23:04 + (Mon, 25 Jul 2005)
New Revision: 8742

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

Log:
fixed handling of zero length names in mprObject()

Modified:
   branches/SAMBA_4_0/source/scripting/ejs/mprutil.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/mprutil.c
===
--- branches/SAMBA_4_0/source/scripting/ejs/mprutil.c   2005-07-25 01:19:16 UTC 
(rev 8741)
+++ branches/SAMBA_4_0/source/scripting/ejs/mprutil.c   2005-07-25 02:23:04 UTC 
(rev 8742)
@@ -29,7 +29,7 @@
 */
 struct MprVar mprObject(const char *name)
 {
-   return ejsCreateObj(name?name:(NULL), MPR_DEFAULT_HASH_SIZE);
+   return ejsCreateObj(name  *name?name:(NULL), MPR_DEFAULT_HASH_SIZE);
 }
 
 /*



svn commit: samba r8743 - in branches/SAMBA_4_0/testprogs/ejs: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 02:23:27 + (Mon, 25 Jul 2005)
New Revision: 8743

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

Log:
automatically find the basedn in ldap.js


Modified:
   branches/SAMBA_4_0/testprogs/ejs/ldap.js


Changeset:
Modified: branches/SAMBA_4_0/testprogs/ejs/ldap.js
===
--- branches/SAMBA_4_0/testprogs/ejs/ldap.js2005-07-25 02:23:04 UTC (rev 
8742)
+++ branches/SAMBA_4_0/testprogs/ejs/ldap.js2005-07-25 02:23:27 UTC (rev 
8743)
@@ -17,13 +17,12 @@
return -1;
 }
 
-if (options.ARGV.length != 2) {
-   println(Usage: ldap.js BASEDN HOST);
+if (options.ARGV.length != 1) {
+   println(Usage: ldap.js HOST);
return -1;
 }
 
-var base_dn = options.ARGV[0];
-var host = options.ARGV[1];
+var host = options.ARGV[0];
 
 function basic_tests(ldb, base_dn)
 {
@@ -50,7 +49,17 @@
 
 }
 
+function find_basedn(ldb)
+{
+var attrs = new Array(defaultNamingContext);
+var res = ldb.search(, , ldb.SCOPE_BASE, attrs);
+assert(res.length == 1);
+return res[0].defaultNamingContext;
+}
+
 var ok = ldb.connect(ldap://; + host);
+var base_dn = find_basedn(ldb);
+
 basic_tests(ldb, base_dn)
 
 return 0;



svn commit: samba r8744 - in branches/SAMBA_4_0/source: include libnet

2005-07-24 Thread abartlet
Author: abartlet
Date: 2005-07-25 02:23:41 + (Mon, 25 Jul 2005)
New Revision: 8744

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

Log:
Split 'net samdump' out into a separate file

Work on the talloc memory tree, as I think talloc_reference and other
things were biting me.  

Crush unions in the name of code reform. ;-)

Andrew Bartlett

Added:
   branches/SAMBA_4_0/source/libnet/libnet_samdump.c
Modified:
   branches/SAMBA_4_0/source/include/structs.h
   branches/SAMBA_4_0/source/libnet/config.mk
   branches/SAMBA_4_0/source/libnet/libnet_vampire.c
   branches/SAMBA_4_0/source/libnet/libnet_vampire.h


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


svn commit: samba r8746 - in branches/SAMBA_4_0/source: . build/tests lib/replace lib/replace/repdir

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 04:03:01 + (Mon, 25 Jul 2005)
New Revision: 8746

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

Log:
replace opendir/readdir/telldir/seekdir/closedir on systems where they
are broken (apparently all BSD systems). This breakage leads to unlink
on files in an open directory causing a later seekdir to miss
files. The bug happens due to a block boundary bug in the BSD libc
implementation of these calls.

This replacement code also fixes a severe memory usage problem with
telldir that can cause closedir() to take an arbitrary amount of time.

I have reported the bug in readdir to Greg Lehey (a FreeBSD maintainer)

Added:
   branches/SAMBA_4_0/source/build/tests/os2_delete.c
   branches/SAMBA_4_0/source/lib/replace/repdir/
   branches/SAMBA_4_0/source/lib/replace/repdir/config.m4
   branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c
Modified:
   branches/SAMBA_4_0/source/configure.in
   branches/SAMBA_4_0/source/lib/replace/config.mk


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


svn commit: samba r8747 - in branches/SAMBA_4_0/source/lib: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 04:03:22 + (Mon, 25 Jul 2005)
New Revision: 8747

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

Log:
remove unused code

Removed:
   branches/SAMBA_4_0/source/lib/ldap_escape.c


Changeset:
Deleted: branches/SAMBA_4_0/source/lib/ldap_escape.c
===
--- branches/SAMBA_4_0/source/lib/ldap_escape.c 2005-07-25 04:03:01 UTC (rev 
8746)
+++ branches/SAMBA_4_0/source/lib/ldap_escape.c 2005-07-25 04:03:22 UTC (rev 
8747)
@@ -1,90 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   ldap filter argument escaping
-
-   Copyright (C) 1998, 1999, 2000 Luke Howard [EMAIL PROTECTED],
-   Copyright (C) 2003 Andrew Bartlett [EMAIL PROTECTED]
-
-  
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include includes.h
-
-/**
- * Escape a parameter to an LDAP filter string, so they cannot contain
- * embeded ( ) * or \ chars which may cause it not to parse correctly. 
- *
- * @param s The input string
- *
- * @return A string allocated with malloc(), containing the escaped string, 
- * and to be free()ed by the caller.
- **/
-
-char *escape_ldap_string_alloc(const char *s)
-{
-   size_t len = strlen(s)+1;
-   char *output = malloc(len);
-   char *output_tmp;
-   const char *sub;
-   int i = 0;
-   char *p = output;
-   
-   while (*s)
-   {
-   switch (*s)
-   {
-   case '*':
-   sub = \\2a;
-   break;
-   case '(':
-   sub = \\28;
-   break;
-   case ')':
-   sub = \\29;
-   break;
-   case '\\':
-   sub = \\5c;
-   break;
-   default:
-   sub = NULL;
-   break;
-   }
-   
-   if (sub) {
-   len = len + 3;
-   output_tmp = realloc(output, len);
-   if (!output_tmp) { 
-   SAFE_FREE(output);
-   return NULL;
-   }
-   output = output_tmp;
-   
-   p = output[i];
-   strncpy (p, sub, 3);
-   p += 3;
-   i += 3;
-
-   } else {
-   *p = *s;
-   p++;
-   i++;
-   }
-   s++;
-   }
-   
-   *p = '\0';
-   return output;
-}



svn commit: samba r8748 - in branches/SAMBA_4_0/source/utils/net: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 04:15:57 + (Mon, 25 Jul 2005)
New Revision: 8748

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

Log:
fixed build. Andrew, please check.


Modified:
   branches/SAMBA_4_0/source/utils/net/net_vampire.c


Changeset:
Modified: branches/SAMBA_4_0/source/utils/net/net_vampire.c
===
--- branches/SAMBA_4_0/source/utils/net/net_vampire.c   2005-07-25 04:03:22 UTC 
(rev 8747)
+++ branches/SAMBA_4_0/source/utils/net/net_vampire.c   2005-07-25 04:15:57 UTC 
(rev 8748)
@@ -29,7 +29,7 @@
 {
NTSTATUS status;
struct libnet_context *libnetctx;
-   union libnet_SamDump r;
+   struct libnet_SamDump r;
 
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
@@ -37,16 +37,14 @@
}
libnetctx-cred = ctx-credentials;
 
-   /* prepare password change */
-   r.generic.level= LIBNET_SAMDUMP_GENERIC;
-   r.generic.error_string = NULL;
+   r.level= LIBNET_SAMDUMP_GENERIC;
+   r.error_string = NULL;
 
-   /* do the domain join */
status = libnet_SamDump(libnetctx, ctx-mem_ctx, r);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,(libnet_SamDump returned %s: %s\n,
 nt_errstr(status),
-r.generic.error_string));
+r.error_string));
return -1;
}
 



svn commit: samba r8749 - in branches/SAMBA_4_0/source/lib/replace/repdir: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 04:34:14 + (Mon, 25 Jul 2005)
New Revision: 8749

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

Log:
for completeness, add rewinddir() and dirfd()


Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c   2005-07-25 
04:15:57 UTC (rev 8748)
+++ branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c   2005-07-25 
04:34:14 UTC (rev 8749)
@@ -125,6 +125,11 @@
}
 }
 
+void rewinddir(DIR *dir)
+{
+   seekdir(dir, 0);
+}
+
 int closedir(DIR *dir)
 {
struct dir_buf *d = (struct dir_buf *)dir;
@@ -136,3 +141,8 @@
return 0;
 }
 
+int dirfd(DIR *dir)
+{
+   struct dir_buf *d = (struct dir_buf *)dir;
+   return d-fd;
+}



svn commit: samba r8750 - in branches/SAMBA_4_0/source/lib/replace/repdir: .

2005-07-24 Thread tridge
Author: tridge
Date: 2005-07-25 04:39:20 + (Mon, 25 Jul 2005)
New Revision: 8750

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

Log:
drat, on some systems dirfd() is a macro



Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c   2005-07-25 
04:34:14 UTC (rev 8749)
+++ branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c   2005-07-25 
04:39:20 UTC (rev 8750)
@@ -141,8 +141,11 @@
return 0;
 }
 
+#ifndef dirfd
+/* darn, this is a macro on some systems. */
 int dirfd(DIR *dir)
 {
struct dir_buf *d = (struct dir_buf *)dir;
return d-fd;
 }
+#endif



svn commit: samba r8751 - in branches/SOC/SAMBA_3_0/source/client: .

2005-07-24 Thread kalim
Author: kalim
Date: 2005-07-25 05:30:40 + (Mon, 25 Jul 2005)
New Revision: 8751

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

Log:
Added initialization stuff for libsmb
'cd' command updated

-kalim
Modified:
   branches/SOC/SAMBA_3_0/source/client/client.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/client/client.c
===
--- branches/SOC/SAMBA_3_0/source/client/client.c   2005-07-25 04:39:20 UTC 
(rev 8750)
+++ branches/SOC/SAMBA_3_0/source/client/client.c   2005-07-25 05:30:40 UTC 
(rev 8751)
@@ -5,6 +5,7 @@
Copyright (C) Simo Sorce   2001-2002
Copyright (C) Jelmer Vernooij  2003
Copyright (C) Gerald (Jerry) Carter2004
+   Copyright (C) Kalim Moghul 2005

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,8 +24,10 @@
 
 #define NO_SYSLOG
 
-#include includes.h
+#include includes.h
+#include libsmbclient.h
 #include client/client_proto.h
+#include client/get_auth_data_fn.h
 #ifndef REGISTER
 #define REGISTER 0
 #endif
@@ -35,7 +38,7 @@
 extern BOOL in_client;
 static int port = 0;
 pstring cur_dir = \\;
-static pstring cd_path = ;
+//static pstring cd_path = ;
 static pstring service;
 static pstring desthost;
 static pstring username;
@@ -258,33 +261,60 @@
struct cli_state *targetcli;
SMB_STRUCT_STAT sbuf;
uint32 attributes;
+int dh;
int ret = 1;
-  
-   dos_format(newdir);
+
+   unix_format(newdir);
 
/* Save the current directory in case the new directory is invalid */
 
pstrcpy(saved_dir, cur_dir);
 
-   if (*p == '\\')
+   if (*p == '/')
pstrcpy(cur_dir,p);
else
pstrcat(cur_dir,p);
 
-   if (*(cur_dir+strlen(cur_dir)-1) != '\\') {
-   pstrcat(cur_dir, \\);
+   if (*(cur_dir+strlen(cur_dir)-1) != '/') {
+   pstrcat(cur_dir, /);
}

-   dos_clean_name(cur_dir);
+/*dos_clean_name(cur_dir);
pstrcpy( dname, cur_dir );
pstrcat(cur_dir,\\);
-   dos_clean_name(cur_dir);
-   
-   if ( !cli_resolve_path( , cli, dname, targetcli, targetpath ) ) {
+   dos_clean_name(cur_dir);*/
+
+
+/* TODO: cleanup debugging print statements*/
+/*d_printf(service: %s\n, service);
+d_printf(desthost: %s\n, desthost);
+d_printf(username: %s\n, username);
+d_printf(calling_name: %s\n, calling_name);
+d_printf(cur_dir: %s\n, cur_dir);*/
+
+/* Format the directory in a libmsmbclient friendly way */
+unix_clean_name(cur_dir);
+   pstrcpy( dname, cur_dir );
+pstrcpy(targetpath, smb:);
+pstrcat(targetpath, service);
+   pstrcat(targetpath, dname);
+unix_format(targetpath);
+/*d_printf(Saved: %s\n, cur_dir);
+d_printf(Result: %s\n, targetpath);*/
+
+   /*if ( !cli_resolve_path( , cli, dname, targetcli, targetpath ) ) {
d_printf(cd %s: %s\n, dname, cli_errstr(cli));
pstrcpy(cur_dir,saved_dir);
goto out;
-   }
+   }*/
+dh = smbc_opendir(targetpath);
+if (dh  0)
+{
+d_printf(%s changing to directory %s\n, strerror(errno), cur_dir);
+pstrcpy(cur_dir, saved_dir);
+return 1;
+}
+smbc_closedir(dh);
 

if ( strequal(targetpath,\\ ) )
@@ -292,7 +322,7 @@

/* use a trans2_qpathinfo to test directories for modern servers */

-   if ( targetcli-protocol = PROTOCOL_LANMAN2 ) {
+   /*if ( targetcli-protocol = PROTOCOL_LANMAN2 ) {
if ( !cli_qpathinfo_basic( targetcli, targetpath, sbuf, 
attributes ) ) {
d_printf(cd %s: %s\n, dname, cli_errstr(targetcli));
pstrcpy(cur_dir,saved_dir);
@@ -313,13 +343,11 @@
pstrcpy(cur_dir,saved_dir);
goto out;
}
-   }
+   }*/
 
ret = 0;
 
 out:
-   
-   pstrcpy(cd_path,cur_dir);
return ret;
 }
 
@@ -2427,7 +2455,6 @@

if (next_token_nr(NULL,buf,NULL,sizeof(buf)))
chdir(buf);
-d_printf(Local directory now %s\n, sys_getwd(d));
DEBUG(2,(the local directory is now %s\n,sys_getwd(d)));
 
return 0;
@@ -2714,6 +2741,8 @@
   {history,cmd_history,displays the command 
history,{COMPL_NONE,COMPL_NONE}},
   {lcd,cmd_lcd,[directory] change/report the local current working 
directory,{COMPL_LOCAL,COMPL_NONE}},
   {link,cmd_link,oldname newname create a UNIX hard 
link,{COMPL_REMOTE,COMPL_REMOTE}},
+  {listconnect,cmd_list_connect,list open 
connections,{COMPL_NONE,COMPL_NONE}},
+  {logon,cmd_logon,establish new logon,{COMPL_NONE,COMPL_NONE}},
   {lowercase,cmd_lowercase,toggle lowercasing of filenames for