Compiler waring with heimdal-0.5.1

2003-03-03 Thread Juergen Hasch
Hi,

I installed heimdal-0.5.1 on my Linux box. When compiling Samba HEAD with gcc 
3.2 I get lots of warning messages like these :

In file included from include/includes.h:421,
 from smbd/notify.c:22:
/usr/include/heimdal/gssapi.h:625: warning: declaration of `open' shadows a 
global declaration
/usr/include/fcntl.h:70: warning: shadowed declaration is here

Anybody else seen this ?

...Juergen



Re: [PATCH] file change notification

2003-03-03 Thread Juergen Hasch
Hi,

attached is a modified version of Hal's file change notification patch.
It's against Samba HEAD and works for me.

Changes:
- use push_ucs2() to send unicode file names
- make some functions static (make proto works now)
- limit maximum number of directory entries stored in the TDB to 2000, so  
  large directories won't create monster TDBs.
- the maximum reply packet size is limited to 64K. I guess this should never
  be a problem :-)
  What ist the maximum allowed size of a NT_TRANS packet anyway ?

...Juergen


--- smbd/notify.orig	2002-12-12 03:01:53.0 +0100
+++ smbd/notify.c	2003-03-03 21:56:56.0 +0100
@@ -21,9 +21,21 @@
 
 #include includes.h
 
+#define MAX_DIRENTRIES 1000
+
 static struct cnotify_fns *cnotify;
 
 /
+This structure holds a list of files and associated notification actions.
+*/
+struct file_action {
+	struct file_action *next, *prev;
+	int action;
+	char *filename;
+	int filename_length;
+};
+
+/
  This is the structure to queue to implement NT change
  notify. It consists of smb_size bytes stored from the
  transact command (to keep the mid, tid etc around).
@@ -35,16 +47,145 @@
 	files_struct *fsp;
 	connection_struct *conn;
 	uint32 flags;
+	uint32 max_parameter_count;
 	char request_buf[smb_size];
 	void *change_data;
+	TDB_CONTEXT *file_data;
+	struct file_action *file_actions;
 };
 
 static struct change_notify *change_notify_list;
 
-/
- Setup the common parts of the return packet and send it.
-*/
-static void change_notify_reply_packet(char *inbuf, NTSTATUS error_code)
+/**
+ * Return a file action struct with the given filename and fileaction
+ *
+ **/
+static struct file_action *change_notify_get_file_action(char *filename, int fileaction)
+{
+	struct file_action *fa;
+
+	if (!(fa = (struct file_action *)malloc(sizeof(struct file_action {
+		DEBUG(0, (malloc failed!));
+	}
+	fa-action = fileaction;
+	fa-filename = strdup(filename);
+	fa-filename_length = strlen(filename);
+
+	return fa;
+}
+
+/**
+ * Check to make sure that the file in the given cnbp.file_data record
+ * still exists.
+ *
+ **/
+static int change_notify_file_data_exists(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, void *status)
+{
+
+	struct file_action *fa;
+	struct change_notify *cnbp = (struct change_notify *)status;
+	char *filename;
+	char *path = ((struct change_notify *)cnbp)-fsp-fsp_name;
+	int filename_len = strlen((char *)key.dptr) + strlen((char *)path) + 2;
+	int fd;
+
+	if (!(filename = (char *)malloc(filename_len))) {
+		DEBUG(0, (malloc failed));
+	}
+
+	filename[0] = '\0';
+	safe_strcat(filename, (char *)path, filename_len);
+	safe_strcat(filename, /, filename_len);
+	safe_strcat(filename, (char *)key.dptr, filename_len);
+
+	if ((fd = open(filename, O_RDONLY)) == -1) {
+		fa = change_notify_get_file_action
+			((char *)key.dptr, FILE_ACTION_REMOVED);
+		DLIST_ADD(cnbp-file_actions, fa);
+	} else {
+		close(fd);
+	}
+
+	return 0;
+}
+
+/**
+ * Get a list of all the file notification actions
+ *
+ **/
+static int change_notify_find_file_actions(struct change_notify *cnbp)
+{
+	void *dp;
+	char *fname;
+	TDB_DATA tdb_key, tdb_data;
+	SMB_STRUCT_STAT old_st, new_st;
+	pstring full_name;
+	size_t fullname_len, remaining_len;
+	char *p;
+	int count;
+	struct file_action *fa;
+
+	cnbp-file_actions = NULL;
+
+	if (!(dp = OpenDir(cnbp-conn, cnbp-fsp-fsp_name, True))) {
+		DEBUG(0, (Failed to open directory '%s',
+			  cnbp-fsp-fsp_name));
+	}
+
+	pstrcpy(full_name, cnbp-fsp-fsp_name);
+	pstrcat(full_name, /);
+
+	fullname_len = strlen(full_name);
+	remaining_len = sizeof(full_name) - fullname_len - 1;
+	p = full_name[fullname_len];
+	count = 0;
+
+	while ((fname = ReadDirName(dp))  count  MAX_DIRENTRIES) {
+		count ++;
+		if (strequal(fname, .) || strequal(fname, ..)) {
+			continue;
+		}
+
+		DEBUG(10, (check file: %s\n, fname));
+		safe_strcpy(p, fname, remaining_len);
+		vfs_stat(cnbp-conn, full_name, old_st);
+		tdb_key.dptr = (void *)fname;
+		tdb_key.dsize = strlen(fname) + 1;
+		tdb_data = tdb_fetch(cnbp-file_data, tdb_key);
+		if (!tdb_data.dptr) {
+			fa = change_notify_get_file_action
+(fname, FILE_ACTION_ADDED);
+			DLIST_ADD(cnbp-file_actions, fa);
+			continue;
+		}
+		new_st = *((SMB_STRUCT_STAT *)tdb_data.dptr);
+		free(tdb_data.dptr);
+		if ((old_st.st_atime != new_st.st_atime) ||
+		(old_st.st_mtime != new_st.st_mtime) ||
+		(old_st.st_ctime != new_st.st_ctime)) {
+			fa = change_notify_get_file_action
+(fname, FILE_ACTION_MODIFIED);
+			DLIST_ADD(cnbp-file_actions, fa);
+		}
+	}
+
+	/* check for deleted files */
+	if (tdb_traverse(cnbp-file_data, 

Re: Compiler waring with heimdal-0.5.1

2003-03-03 Thread Juergen Hasch
Am Montag, 3. März 2003 23:48 schrieb [EMAIL PROTECTED]:
 On Mon, Mar 03, 2003 at 10:21:06PM +0100, Love wrote:
  [EMAIL PROTECTED] writes:
   Anybody else seen this ?
  
   This is brokenness in the Heimdal header files, not in Samba.
   The Heimdal developers need to compile with more warnings set
   in gcc.
 
  What more then
 
  -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast
  -Wmissing-declarations -Wnested-externs

 Yep :-). Please add :

 -Wshadow -Wstrict-prototypes -Wcast-qual -Wcast-align -Wwrite-strings

 Jeremy.

I changed the function prototype in gssapi.h for now.
Thanks.

...Juergen



Re: [PATCH] file change notification

2003-02-14 Thread Juergen Hasch
Hello Hal,

thanks for  coding this patch, unfortunately it doesn't work for me.
Checking the generated network packets with ethereal shows that the 
NT_NOTIFY packet I receive on the Windwows side
is invalid. The packet (frame size as shown in ethereal) is much too 
short, it's size is 93 bytes, it should be 162.
Below is the hex dump of a defect packet:
  00 04 e2 1c 6f c0 00 04  e2 1c 6f 55 08 00 45 10   ..â.oÀ.. â.oU..E.
0010  00 4f 18 e6 40 00 40 06  a0 56 c0 a8 00 04 c0 a8   .O.æ@.@.  VÀ¨..À¨
0020  00 08 00 8b 04 c8 0e 6a  4a aa d4 2d f3 f9 50 18   .È.j JªÔ-óùP.
0030  16 d0 01 12 00 00 00 00  00 23 ff 53 4d 42 a0 00   .Ð.. .#ÿSMB .
0040  00 00 00 88 01 00 00 00  00 00 00 00 00 00 00 00    
0050  00 00 01 00 9c 05 64 00  c0 6f 40 20 00..d. Ào@ .  

This is what a W2K generated  packet looks like:
  00 04 e2 1c 6f c0 00 50  56 4b 85 6f 08 00 45 10   ..â.oÀ.P VK.o..E.
0010  00 94 da 29 40 00 40 06  de bf c0 a8 00 12 c0 a8   ..Ú)@.@. Þ¿À¨..À¨
0020  00 08 00 8b 04 ba 92 f9  13 50 b8 db b8 fd 50 18   .º.ù .P¸Û¸ýP.
0030  2e 10 9a 20 00 00 00 00  00 68 ff 53 4d 42 a0 00   ...  .hÿSMB .
0040  00 00 00 88 01 00 00 00  00 00 00 00 00 00 00 00    
0050  00 00 01 00 c0 03 64 00  c1 ac 12 00 00 00 1e 00   À.d. Á¬..
0060  00 00 00 00 00 00 1e 00  00 00 48 00 00 00 00 00    ..H.
0070  00 00 00 00 00 00 68 00  00 00 00 00 00 00 00 21   ..h. ...!
0080  00 00 00 00 00 00 03 00  00 00 12 00 00 00 66 00    ..f.
0090  69 00 6c 00 65 00 32 00  2e 00 74 00 78 00 74 00   i.l.e.2. ..t.x.t.
00a0  00 00  ..  

I attached my own hack which creates a reply packet identical to Windows 
(see the change_notify_reply_packet function).
It only replies one single file name per reply packet, because you don't 
get more than one file change per signal using dnotify.

Another thing I noticed is that you don't return an unicode filename, 
you simply return the filename with the unix charset
and pad it with zeroes. Please convert the filename to Unicode when you 
assemble the packet.

...Juergen

--- smbd/notify_kernel.orig 2003-01-14 21:57:16.0 +0100
+++ smbd/notify_kernel.c2003-02-02 00:01:24.0 +0100
@@ -37,7 +37,6 @@
 #define DN_MULTISHOT0x8000  /* Don't remove notifier */
 #endif
 
-
 #ifndef RT_SIGNAL_NOTIFY
 #define RT_SIGNAL_NOTIFY 34
 #endif
@@ -50,6 +49,14 @@
 #define F_NOTIFY 1026
 #endif
 
+#define F_NOTIFY_FN1027
+
+/* this gets returned from the kernel */
+struct dnotify_info_struct {
+   unsigned long   event;
+   char filename[NAME_MAX+1];
+};
+
 /
  This is the structure to keep the information needed to
  determine if a directory has changed.
@@ -57,6 +64,8 @@
 
 struct change_data {
int directory_handle;
+// uint32 Action;
+   struct dnotify_info_struct fi;
 };
 
 /
@@ -95,9 +104,10 @@
BlockSignals(True, RT_SIGNAL_NOTIFY);
for (i = 0; i  signals_received; i++) {
if (data-directory_handle == (int)fd_pending_array[i]) {
-   DEBUG(3,(kernel_check_notify: kernel change notify on %s 
fd[%d]=%d (signals_received=%d)\n,
-   path, i, (int)fd_pending_array[i], 
(int)signals_received ));
-
+   data-fi.event=0;
+   fcntl((int)fd_pending_array[i],F_NOTIFY_FN,(data-fi.event));
+   DEBUG(0,(kernel_check_notify: kernel change notify on %s in 
+file %s, event %d, fd[%d]=%d (signals_received=%d)\n,
+   path, 
+data-fi.filename,data-fi.event, i, (int)fd_pending_array[i], (int)signals_received 
+));
close((int)fd_pending_array[i]);
fd_pending_array[i] = (SIG_ATOMIC_T)-1;
if (signals_received - i - 1) {
@@ -166,7 +176,7 @@
return NULL;
}
 
-   kernel_flags = DN_CREATE|DN_DELETE|DN_RENAME; /* creation/deletion changes 
everything! */
+   kernel_flags = DN_CREATE|DN_DELETE|DN_RENAME|DN_MULTISHOT; /* 
+creation/deletion changes everything! */
if (flags  FILE_NOTIFY_CHANGE_FILE)kernel_flags |= DN_MODIFY;
if (flags  FILE_NOTIFY_CHANGE_DIR_NAME)kernel_flags |= 
DN_RENAME|DN_DELETE;
if (flags  FILE_NOTIFY_CHANGE_ATTRIBUTES)  kernel_flags |= DN_ATTRIB;
--- smbd/notify.orig2003-01-14 21:57:29.0 +0100
+++ smbd/notify.c   2003-02-02 00:40:54.0 +0100
@@ -45,20 +45,54 @@
 /
  Setup the common parts of the return packet and send it.
 */
-static void 

Re: [PATCH] file change notification

2003-02-14 Thread Juergen Hasch
Hi Tim,

Am Freitag, 14. Februar 2003 21:52 schrieb Tim Potter:
 On Fri, Feb 14, 2003 at 08:28:55PM +0100, Juergen Hasch wrote:
  Hello Hal,
 
  thanks for  coding this patch, unfortunately it doesn't work for me.
  Checking the generated network packets with ethereal shows that the
  NT_NOTIFY packet I receive on the Windwows side
  is invalid. The packet (frame size as shown in ethereal) is much too
  short, it's size is 93 bytes, it should be 162.

 How well does ethereal handle SMB change notify?  I can honestly say
 that I've never seen it happen.  (-:

actually it looks quite good :-)
Attached is a capture from two W2K machines talking to each other.
Packet No. 19 shows the NT NOTIFY response packet.

This capture was made using the Windows version of ethereal, the Linux
version crashes on my machine when opening the capture file.
Maybe you can fix that ;-)

 If you send me a bunch of captures I can fix any misdissections or
 any other problems with ethereal in this regard.


 Tim.

...Juergen



Re: file change notification issues

2003-02-01 Thread Juergen Hasch
Jeremy,

[EMAIL PROTECTED] wrote:


Great detective work ! Actaully this is a bug in IIS. The
protocol states that STATUS_NOTIFY_ENUM_DIR is a valid return,
if too many files were changed (hmmm. define too many :-).

It would be possible to cause this to break on Windows 2000
servers also, but I imagine that under 'normal' circumstances
few enough files have changed that this doesn't cause a problem
for IIS.


well it looks like Matlab, the application I'm having trouble with, also 
doesn't like STATUS_NOTIFY_ENUM_DIR
as return value. It starts polling its working directory like crazy, 
which is quite annyoing (you can change the program
configuration, but this is the default for me). Older versions of Matlab 
behave better, I checked this some time ago.

I hacked a patch to have Samba behave like W2K and deliver the name of 
the changed file and it looks quite good.
No more endless file stat polling, so I'm all for adding this 
functionality to Samba :-)

The most difficult part is getting a file name from Linux  without 
reimplementing the change  notification interface.
I don't like fam or dazuko or the other stuff that is available as an 
alternative to the kernel  dnotify support,
it's too much bloat.
For now I simply added a fcntl to the Linux kernel to return the desired 
file name. This requires only minor changes
in Samba and Linux, however it has most likely races in it and will 
probably only work for my  most simple case...

...Juergen

Btw. my original problem from my posts last week was different. It seems 
like the behaviour I was describing only
happens when running Samba in a VMware session. Testing on several real 
machines doesn't show the problem.
Odd... I can still send you traces, but I think it's not that interesting.










Change Notification

2003-01-13 Thread Juergen Hasch
Jeremy,

I'm having problems with change notification in Samba 2.2.x under Linux 
since you changed the signal
handling stuff some time ago.
An application I'm using always complains about missing change 
notification, although it used to work.
I always failed to find out what's wrong, but now I know :-)

What is happening is that Samba receives a change notification signal 
from the Linux kernel and sometimes
simply does not process it, which means that no further signals will be 
send by the Kernel (DN_MULTISHOT isn't set)
for the same event.
Processing of the received signal happens for file rename and delete in 
but not for copying.
In reply.c/reply_write_and_X() I added  a call to
   process_pending_change_notify_queue((time_t)0);
and now change notification works again for my testcase here.

I'm sure you now a better place where  
process_pending_change_notify_queue() should go to catch
file copy events :-)

..Juergen




Re: Change Notification

2003-01-13 Thread Juergen Hasch
Below is my test program, nothing special:

/* test change notification */
#include windows.h
#include stdio.h

int main()
{
DWORD dwWaitStatus;
HANDLE dwChangeHandles[1];


dwChangeHandles[0] = FindFirstChangeNotification(
   i:\\TEST, // directory to watch
   FALSE, // do not watch the subtree
   FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes


if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
   exit(GetLastError());

printf(Starting change notification\n);
// Change notification is set. Now wait on both notification
// handles and refresh accordingly.

   while (TRUE) {
   dwWaitStatus = WaitForMultipleObjects(1, dwChangeHandles,
   FALSE, INFINITE);

   printf(.);
   switch (dwWaitStatus) {
   case WAIT_OBJECT_0:
   if (FindNextChangeNotification( dwChangeHandles[0]) == 
FALSE )
   exit(GetLastError());
   break;
   default:
   printf( Change notify failure\n);
   exit(0);
   break;
   }
   }
   return 0;
}

I can't tell you if the change I made to reply.c completely solves my 
problem , I'll need to test this at work.
But what I found out would explain the effects I had.

...Juergen




Re: Change Notification

2003-01-13 Thread Juergen Hasch
[EMAIL PROTECTED] wrote:


So if I'm understanding you correctly this is actually a kernel
bug - correct ?

Can you point me at the areas in the kernel source where the problem
occurs so I can see how to make smbd work around it until we get the
kernel fixed.

 

No it's Samba receiving a signal from the kernel, but not processing it 
further inside Samba.

In notify_kernel/signal_handler() signals_received gets increased when a 
change notification
is received from the kernel. Now the change notification for this type 
of event (e.g. copy/
rename/delete...) needs to be processed inside Samba.
This is done in process_pending_change_notify_queue() which is called 
from a few places
inside e.g. reply.c.
This is not happening for file copy in my test setup here (using the 
copy command in windows).
This means the kernel change notification is no longer active for this 
type of event, because it
needs to be restarted in notify_kernel.c/kernel_register_notify().

Eventually process_pending_change_notify_queue() is called by chance and 
the received
change notification signal gets processed at a later random time.

So I think Samba forgets to call process_pending_change_notify_queue() 
after a copy operation,
so a Windows application waiting for a change notification doesn't get 
noticed or only after some
time when other file operations triggered the 
process_pending_change_notify_queue() call.

...Juergen




Re: RFE: build

2003-01-05 Thread Juergen Hasch
Hi Jens,

Jens Elkner wrote:


1)  For SHLD the LDSHFLAGS parameter is used. It should get set to -shared.
   


And that is exactly the problem! It is set only to -shared and not to
-shared $LDFLAGS. So if I do not apply the Makefile.in patch
I get for build:

Linking libsmbclient shared library bin/libsmbclient.so
gcc  -shared -o bin/libsmbclient.so libsmb/libsmbclient.po lib/charcnv.po lib/charset.po lib/debug.po lib/fault.po lib/getsmbpass.po lib/interface.po lib/kanji.po lib/md4.po lib/interfaces.po lib/pidfile.po lib/replace.po lib/signal.po lib/system.po lib/sendfile.po lib/time.po lib/ufc.po lib/genrand.po lib/username.po lib/util_getent.po lib/access.po lib/smbrun.po lib/bitmap.po lib/crc32.po lib/snprintf.po lib/wins_srv.po lib/util_str.po lib/util_sid.po lib/util_unistr.po lib/util_file.po lib/util.po lib/util_sock.po lib/util_sec.po smbd/ssl.po lib/talloc.po lib/hash.po lib/substitute.po lib/fsusage.po lib/ms_fnmatch.po lib/select.po lib/error.po lib/messages.po lib/pam_errors.po nsswitch/wb_client.po nsswitch/wb_common.po tdb/tdb.po tdb/spinlock.po tdb/tdbutil.po  libsmb/clientgen.po libsmb/cliconnect.po libsmb/clifile.po libsmb/clirap.po libsmb/clierror.po libsmb/climessage.po libsmb/clireadwrite.po libsmb/clilist.po libsmb/cliprint.po libsmb/clitrans.po libsmb/clisecdesc.!
po libsmb/clidgram.po libsmb/namequery.po libsmb/nmblib.po libsmb/clistr.po libsmb/nterr.po libsmb/smbdes.po libsmb/smbencrypt.po libsmb/smberr.po libsmb/credentials.po libsmb/pwd_cache.po libsmb/clioplock.po libsmb/errormap.po libsmb/doserr.po libsmb/passchange.po libsmb/unexpected.po rpc_parse/parse_prs.po rpc_parse/parse_sec.po rpc_parse/parse_misc.po libsmb/namecache.po param/loadparm.po param/params.po  ubiqx/ubi_BinTree.po ubiqx/ubi_Cache.po ubiqx/ubi_SplayTree.po ubiqx/ubi_dLinkList.po ubiqx/ubi_sLinkList.po ubiqx/debugparse.po -lacl -lcups  -lnsl \
-Wl,-soname=`basename bin/libsmbclient.so`.0

/usr/bin/ld: cannot find -lacl
collect2: ld returned 1 exit status
make: *** [bin/libsmbclient.so] Error 1


You are right, $(LDFLAGS) is missing for libsmbclient.
I think the correct patch would be to add the missing $(LDFLAGS) in 
Makefile.in only where it is missing:
--
--- Makefile.in.orig2002-09-20 21:10:45.0 +0200
+++ Makefile.in2003-01-05 23:15:22.0 +0100
@@ -645,7 +645,7 @@

bin/libsmbclient.@SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS) bin/.dummy
@echo Linking libsmbclient shared library $@
-@$(SHLD) @LDSHFLAGS@ -o $@ $(LIBSMBCLIENT_PICOBJS) $(LIBS) \
+@$(SHLD) @LDSHFLAGS@ -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \
@SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)

bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) bin/.dummy

--
I guess nobody ever had this problem before and complained loud enough 
about it  :-)

2) cups-config is coming from the cups installation. It's created when 
you run
configure at the cups source. You can specify the directories there. If 
you install
cups from a rpm it should also be correct.
   


And that´s exactly the point. if you install it - I do not want to
install it on the system, where smb is build ... Furthermore, why should
the smb stuff linked against the same libs, libcups was linked to?
Perhaps cups has (not yet) its own mechanism, to find the libs it needs ...


Look at
http://cvs.samba.org/cgi-bin/cvsweb/samba/source/configure.in.diff?r1=1.130.4.144r2=1.130.4.145only_with_tag=SAMBA_2_2f=h
There you see the way configure.in was before cups-config was used. You 
see it's not just looking for libcups and cups.h ...

...Juergen





Re: RFE: build

2003-01-04 Thread Juergen Hasch
Hi Jens,


I just tried to build samba 2.2.7a with cups and acl, but it did
not work out of the box without fixing source/Makefile.in,
source/configure.in and include/smb_acls.h.


Samba should build fine on most systems.
What operating system and gcc / ld version do you use ?

Your patches don't seem right, please show your ./configure output.

1)  For SHLD the LDSHFLAGS parameter is used. It should get set to -shared.

2) cups-config is coming from the cups installation. It's created when 
you run
configure at the cups source. You can specify the directories there. If 
you install
cups from a rpm it should also be correct.

3) Not true. sys/acl.h gets included in includes.h
Configure obviously didn't find the acl includes.

4) Where did you install the acl headers ?
For most systems Samba should be able to find the acl headers and 
libraries itself.

It looks like you have a fairly non-standard system or moved your 
software packages all around :-)
...Juergen

If you have the time, please have a look at the following patches:

1) Makefile.in:
  we need to pass LDFLAGS to the $SHLD (i.e. usually gcc -shared),
  otherwise the linker may not find required libs or link the binary
  against a lib in the default LD_LIBRARY_PATH and not against the
  lib[s], which the user wants to. Furthermore it installs the
  libsmbclient libs in $(LIBDIR) and ,perhaps not so smart, it adds
  installclientlib to the install target:

--schnipp--
--- samba-2.2.7a/source/Makefile.in.orig	Tue Dec 10 15:58:00 2002
+++ samba-2.2.7a/source/Makefile.in	Sat Jan  4 18:33:24 2003
@@ -11,10 +11,10 @@
LIBS=@LIBS@
LDAPLIBS=@LDAPLIBS@
CC=@CC@
-SHLD=@SHLD@ 
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
+SHLD=@SHLD@ $(LDFLAGS)
AWK=@AWK@
DYNEXP=@DYNEXP@

@@ -695,7 +695,7 @@
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(TDBDUMP_OBJ)

-install: installbin installman installscripts installcp installswat
+install: installbin installman installscripts installcp installswat installclientlib

installdirs:
	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) $(BASEDIR)
@@ -723,7 +723,7 @@
	@$(SHELL) $(srcdir)/script/installswat.sh $(SWATDIR) $(srcdir)

installclientlib:
-	-$(INSTALLCMD) bin/libsmbclient.so
+	-$(INSTALLCMD) bin/libsmbclient.* $(LIBDIR)/
	-$(INSTALLCMD) -d ${prefix}/include
	-$(INSTALLCMD) include/libsmbclient.h ${prefix}/include
	
--schnapp--


2) CUPS: IMHO, using pseudo intelligent tools like cups-config is not
  very smart! What, if a user has moved its installation e.g. from /usr
  to /usr/local? Is he required, to fix cups-config manually as well?

  Nevertheless, configure allows the user to define the include and
  lib path for openssl, why not for cups? If one just wants to
  build the package, the current approach does not work, since it
  assumes, that cups is installed on the system. Also it does not
  make sense, to link smb binaries agains e.g. against -lssl -lcrypto
  (LIBS=$LIBS `$CUPS_CONFIG --libs`) if it is not required. 
  smb depends on cups, but not on openssl (if not configured).
  If libcups depends on openssl, it is the task of libcups[package],
  to find resolve/satisfy calls to a library, not required by smb
  itself. Otherwise, to be consequent, smb should be linked explizit
  against libattr, which is not required by smb but by libacl ...

  So my suggestion is:

--schnipp--
--- samba-2.2.7a/source/configure.in.orig	Tue Dec 10 02:01:00 2002
+++ samba-2.2.7a/source/configure.in	Sat Jan  4 16:35:21 2003
@@ -491,14 +491,12 @@
[  --enable-cups   Turn on CUPS support (default=auto)])

if test x$enable_cups != xno; then
-	AC_PATH_PROG(CUPS_CONFIG, cups-config)
-
-if test x$CUPS_CONFIG != x; then
-	AC_DEFINE(HAVE_CUPS)
-		CFLAGS=$CFLAGS `$CUPS_CONFIG --cflags`
-		LDFLAGS=$LDFLAGS `$CUPS_CONFIG --ldflags`
-		LIBS=$LIBS `$CUPS_CONFIG --libs`
-fi
+	AC_HAVE_LIBRARY(cups, [
+		AC_TRY_CPP([#include cups/cups.h
+			#include cups/language.h],
+			[ AC_DEFINE(HAVE_CUPS) LIBS=-lcups $LIBS],
+			AC_MSG_WARN([cups headers not found - cups support disabled]))
+	])
fi


--schnapp--


3) POSIX acl support lacks the acl.h include. So we need:

--schnipp--
--- samba-2.2.7a/source/include/smb_acls.h.orig	Fri Feb  1 23:13:09 2002
+++ samba-2.2.7a/source/include/smb_acls.h	Sat Jan  4 06:29:54 2003
@@ -25,7 +25,7 @@
#include includes.h

#if defined(HAVE_POSIX_ACLS)
-
+#include sys/acl.h
/* This is an identity mapping (just remove the SMB_). */

#define SMB_ACL_TAG_T   acl_tag_t
--schnapp--

4) Things, which may improve the build process: 
		--with-aclinc=DIR
		--with-acllib=DIR
  otherwise one has always to set CFLAGS, CPPFLAGS, LDFLAGS and
  LD_LIBRARY_PATH before building smb...


Regards,
jens.
 






[Patch] configure.in

2002-09-22 Thread Juergen Hasch

Stupid me,
you can't check for ${GCC} = no, because if it isn't gcc, the compiler
name will be there instead of a no.
Please apply.

..Juergen

--- configure.in.orig   Sat Sep 21 10:14:45 2002
+++ configure.inSun Sep 22 10:28:34 2002
 -916,7 +916,7 
LDSHFLAGS=-Wl,-bexpall,-bM:SRE,-bnoentry
DYNEXP=-Wl,-brtl,-bexpall
PICFLAG=-O2
-   if test ${GCC} = no; then
+   if test ${GCC} != yes; then
## for funky AIX compiler using strncpy()
CFLAGS=$CFLAGS -D_LINUX_SOURCE_COMPAT 
-qmaxmem=32000
fi




Re: VFS Virus Scanner idea...

2002-09-12 Thread Juergen Hasch

Am Donnerstag, 12. September 2002 21:30 schrieb Christopher R. Hertel:
 I was at a meeting today and one of the participants came up to me after
 the meeting to ask a Samba-related question.  The problem he is facing
 is that he's got a bunch of Windows clients which are, of course,
 vulnerable to viruses and such.  During the meeting there was some
 discussion of software that would run on a Novell NetWare server and scan
 for windows viruses in real time.  The question was: could this be done
 with Samba?

 After thinking a moment it occurred to me that it should be possible to
 build a Samba VFS layer that would do virus scanning *iff* there is Open
 Source virus scanning software available.  Files could be scanned on open,
 create, close.

 I don't know if this idea has been suggested before.  I think it would be
 a very nice feature for Samba if it could be made to work.

It's all done, just look at www.openantivirus.org. Under projects you will
find the samba-vscan module from Rainer Link.

...Juergen




Re: VFS Virus Scanner idea...

2002-09-12 Thread Juergen Hasch

Am Donnerstag, 12. September 2002 22:34 schrieb Christopher R. Hertel:
 Kewl.  :)

 I figured that if I asked around a bit magic would happen.  I just found
 out about OpenAntiVirus a few minutes ago.  Thanks for the pointer!

It's also interesting that you can download the scan engine and the
virus signature data base from trend micro and use it with the Samba VFS 
module without even buying their product :-)

I found no indication on their website if this is legal or not...

...Juergen




Re: recycle.c (was block.c)

2002-09-03 Thread Juergen Hasch

Am Montag, 2. September 2002 20:56 schrieb Alexander Bokovoy:

  I've updated the recycle bin to use the parametrical options inside
  smb.conf. I think you told me at the SambaXP conference how to find out,
  if the service is derived from [homes]. Could you tell me again ?

 I promized tridge to fix this but haven't done it yet. Expect this in a
 middle of September. :(

  I need to find this out or the parametrical options won't work for
  [homes].

 Metze did something to fix this by specifying user names as shares. This
 is a hack and I must complete parametrical options instead.


For now I'm using my old patch for loadparam.c and these lines in 
vfs_recycle.c:

if (lp_home_service(SNUM(conn)) == True )
servicename = lp_homes_name();
else
servicename = lp_servicename(SNUM(conn));
 
Btw. what was the reason for removing libtool ?
Building VFS modules for AIX and Solaris is broken now and Linux VFS modules 
are 10 times the size they were before.

...Juergen


--- param/loadparm.orig	Thu Aug 29 20:14:45 2002
+++ param/loadparm.c	Tue Sep  3 20:43:18 2002
 -384,8 +384,9 
 	BOOL bUseClientDriver;
 	BOOL bDefaultDevmode;
 	BOOL bNTAclSupport;
+	BOOL bHomeService;
 
-	char dummy[3];		/* for alignment */
+	char dummy[2];		/* for alignment */
 }
 service;
 
 -504,6 +505,7 
 	False,			/* bUseClientDriver */
 	False,			/* bDefaultDevmode */
 	True,			/* bNTAclSupport */
+	False,			/* bHomeService */
 
 /* dummy */
 };
 -1743,6 +1745,8 
 FN_GLOBAL_BOOL(lp_algorithmic_rid_base, Globals.bAlgorithmicRidBase)
 FN_GLOBAL_INTEGER(lp_name_cache_timeout, Globals.name_cache_timeout)
 
+FN_LOCAL_BOOL(lp_home_service, bHomeService)
+
 typedef struct _param_opt_struct param_opt_struct;
 struct _param_opt_struct {
 	char *key;
 -1950,6 +1954,7 
 	}
 	ServicePtrs[i]-bAvailable = sDefault.bAvailable;
 	ServicePtrs[i]-bBrowseable = sDefault.bBrowseable;
+	ServicePtrs[i]-bHomeService = True;
 
 	DEBUG(3,
 	  (adding home's share [%s] for user '%s' at '%s'\n, pszHomename, 
 -3398,6 +3403,15 
 }
 
 /***
+ Return name of HOMES service
+***/
+
+const char* lp_homes_name(void)
+{
+	return (HOMES_NAME);
+}
+
+/***
  Have we loaded a services file yet?
 ***/
 



recycle.c (was block.c)

2002-09-02 Thread Juergen Hasch

Hi Alexander,

Am Montag, 2. September 2002 11:03 schrieb Alexander Bokovoy:

 Seens xlc_r is stricter. Would following help xlc_r? It looks worser but
 works fine for gcc.

 #define VFS_OP(x) ((void *) x)

 static vfs_op_tuple recycle_ops[] = {

   /* Disk operations */

   {VFS_OP(recycle_connect),   SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_OPAQUE},
   {VFS_OP(recycle_disconnect),SMB_VFS_OP_DISCONNECT,  SMB_VFS_LAYER_OPAQUE},

   /* File operations */

   {VFS_OP(recycle_unlink),SMB_VFS_OP_UNLINK,  SMB_VFS_LAYER_OPAQUE},

   {NULL,  SMB_VFS_OP_NOOP,SMB_VFS_LAYER_NOOP}
 };

this works, the compiler doesn't complain anymore.

I've updated the recycle bin to use the parametrical options inside smb.conf. 
I think you told me at the SambaXP conference how to find out, if the service 
is derived from [homes]. Could you tell me again ?

I need to find this out or the parametrical options won't work for [homes]. 

For now the options have the form:

vfs_recycle: mode = KEEP_DIRECTORIES|TOUCH

Should be clear which module they belong to :-)

...Juergen




Small patches for Samba_2_2

2002-09-01 Thread Juergen Hasch

Hi,

attached are three small patches for Samba_2_2 CVS.
The first patch fixes a typo in web/swat.c.
The second patch changes a compiler option for AIX to allow the compiler to 
use more memory.
The last patch updates the recylce bin. This change was suggested by Guilio 
Orsero.

...Juergen


--- configure.in.orig	Fri Aug 23 22:34:32 2002
+++ configure.in	Sun Sep  1 17:05:12 2002
 -915,12 +915,10 
 			BLDSHARED=true
 			LDSHFLAGS=-Wl,-bexpall,-bM:SRE,-bnoentry
 			DYNEXP=-Wl,-brtl,-bexpall
-			if test ${GCC} = yes; then
 PICFLAG=-O2
-			else
-PICFLAG=-O2 -qmaxmem=6000
+			if test ${GCC} = no; then
 ## for funky AIX compiler using strncpy()
-CFLAGS=$CFLAGS -D_LINUX_SOURCE_COMPAT
+CFLAGS=$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000
 			fi

 			AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)


--- recycle.orig	Wed Aug 28 19:09:49 2002
+++ recycle.c	Sun Sep  1 17:45:38 2002
 -154,8 +154,6 
 		if (current-recycle_bin == NULL)
 			return False;
 		current-recycle_bin = safe_strcpy(current-recycle_bin,pszParmValue,sizeof(pstring));
-		standard_sub_basic(current-recycle_bin, strlen(current-recycle_bin));
-		trim_string(current-recycle_bin,/,/);
 		DEBUG(10, (name=%s\n, current-recycle_bin));
 	} else if (StrCaseCmp(mode,pszParmName)==0) {
 		if (checkparam(pszParmValue,KEEP_DIRECTORIES) == True)
 -256,6 +254,8 
 		rc=pm_process( conf_file, do_section, do_parameter);
 		DEBUG(10, (pm_process returned %d\n, rc));
 	}
+	standard_sub_conn( conn , current-recycle_bin,sizeof(pstring));
+	trim_string(current-recycle_bin,/,/);
 	conn-vfs_private= (void *)current;
 	return 0;
 }


--- web/swat.c.orig	Fri Aug 23 22:34:45 2002
+++ web/swat.c	Sun Sep  1 17:24:46 2002
 -746,7 +746,7 
 	printf(tdinput type=radio name=\WINSType\ value=0 %s Not Usednbsp;/td, (winstype == 0) ? checked : );
 	printf(tdinput type=radio name=\WINSType\ value=1 %s Server for client usenbsp;/td, (winstype == 1) ? checked : );
 	printf(tdinput type=radio name=\WINSType\ value=2 %s Client of another WINS servernbsp;/td, (winstype == 2) ? checked : );
-	printf(trtd/tdtd/tdtd/tdtdRemote WINS Servernbsp;input type=text size=\16\ name=\WINSAddr\ value=\\%s\/td/tr,lp_wins_server());
+	printf(trtd/tdtd/tdtd/tdtdRemote WINS Servernbsp;input type=text size=\16\ name=\WINSAddr\ value=\%s\/td/tr,lp_wins_server());
 	if (winstype == 3) {
 		printf(trtd/tdtd colspan=3font color=\#ff\Error: WINS Server Mode and WINS Support both set in smb.conf/font/td/tr);
 		printf(trtd/tdtd colspan=3font color=\#ff\Please Select desired WINS mode above./font/td/tr);



Re: [PATCH]block.c

2002-09-01 Thread Juergen Hasch

Hi Alexander,

Am Donnerstag, 29. August 2002 10:27 schrieb Alexander Bokovoy:
 On Wed, Aug 28, 2002 at 07:46:36PM +0200, Juergen Hasch wrote:
  Hi Jelmer,
 
  I'm not using the block module,  it's just that some C compilers don't
  like C++ comments. This stops building the VFS modules for me.

 Juergen, could you please send an update for you recycle bin module for
 HEAD?

I've put an updated version on www.elbonia.de/samba/recycle_head.html

However I get some errors when compiling under AIX with xlc_r compiler :
recycle.c, line 75.10: 1506-196 (E) Initialization between types void* and 
int(*)(struct connection_struct*,const char*,const char*) is not allowed.
recycle.c, line 76.10: 1506-196 (E) Initialization between types void* and 
void(*)(struct connection_struct*) is not allowed.
recycle.c, line 80.10: 1506-196 (E) Initialization between types void* and 
int(*)(struct connection_struct*,const char*) is not allowed.

This happens for other VFS modules, too. GCC doesn't complain here.

...Juergen




Re: Samba 2.2.5 has been released

2002-06-22 Thread Juergen Hasch

Am Donnerstag, 20. Juni 2002 13:50 schrieb Rainer Link:
 Gerald Carter schrieb:

 [..]

  10) Inclusion of autoconf script for building VFS modules

 Hm, configure.in/configure in examples/VFS does not check for LFS
 support, therefore the modules aren't compiled with
 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

 I ran into troubles months ago, as my samba-vscan stuff wasn't compiled
 with the flags mentioned above, but Samba (smbd) itself was.

 Sorry, my time is simply to limited to have a closer look at it. Anyone?
 Thanks!

 cheers, Rainer

this has been solved some time ago. Jeremy added the defines to config.h.

...Juergen





Re: samba 2.2.5-pre and solaris 9

2002-06-07 Thread Juergen Hasch

Am Freitag, 7. Juni 2002 21:57 schrieb Gerald Carter:
 On Fri, 7 Jun 2002, Juergen Hasch wrote:
  +dnl Check if we use GNU ld
  +LD=ld
  +AC_PROG_LD_GNU

 That's what I needed.  I couldn't find it mentioned in my book.
I hadn't known that one too, but google is your friend :-)

 Looks good to me.  Do we still need to pass the -Wl flag to Sun's ld?
Yes, because we are calling GCC and not ld directly:
  $(CC) $(FLAGS) -o $ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)

...Juergen





Re: samba 2.2.5-pre and solaris 9

2002-06-07 Thread Juergen Hasch

Hi Don,

Am Freitag, 7. Juni 2002 23:27 schrieb Don Koch:
 [EMAIL PROTECTED] said:
  Do we still need to pass the -Wl flag to Sun's ld?

 [EMAIL PROTECTED] said:
  Yes, because we are calling GCC and not ld directly:
@$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)

 Well, no, you don't.  -Wl,-xxx is used to pass the -xxx option to the
 linker being used (e.g., the aforementioned -Wl,-E to pass the -E option
 to gnu ld).  If you aren't passing anything to the sun linker, -Wl
 shouldn't be used.

you are right, I confused things. We only need to set DYNEXP=Wl,-E when we 
use GCC and GNU LD. All other cases under Solaris doesn't need a DYNEXP at 
all.

Or is anybody using Sun's cc with GNU LD ?

...Juergen





Re: known BUG multi-byte character set in usernames

2002-06-06 Thread Juergen Hasch

Am Donnerstag, 6. Juni 2002 01:19 schrieb Jeremy Allison:
 On Thu, Jun 06, 2002 at 12:12:45AM +0200, Juergen Hasch wrote:
  the patch works fine for except for one thing. In the acl security
  selection list (showing a list of all available users and groups) the
  german umlaut characters are wrong. This is because the unix charset is
  sent to the windows client, as no conversion back takes place.
  The acl dialogue itself is ok.
 
  I haven't found out yet, where the conversion back to dos code page
  should take place. Do you have an idea ?

 Can you CVS update SAMBA_2_2 - I've just applied a patch I think
 should fix this.

not yet :-)

The diff below shows what I changed to make it work AFAICS:

--- srv_lsa_nt.c.orig   Wed Jun  5 23:52:45 2002
+++ srv_lsa_nt.cThu Jun  6 20:53:05 2002
 -152,6 +152,8 
/* Split name into domain and user component */

pstrcpy(full_name, dos_unistr2_to_str(name[i]));
+   dos_to_unix(full_name);
split_domain_name(full_name, dom_name, user);

/* Lookup name */
--- srv_samr_nt.c.orig  Fri Mar 29 22:53:33 2002
+++ srv_samr_nt.c   Thu Jun  6 20:40:50 2002
 -660,6 +660,8 
int len = strlen(grp[i].name)+1;

init_sam_entry(sam[i], len, grp[i].rid);
+   unix_to_dos(grp[i].name);
init_unistr2(uni_name[i], grp[i].name, len);
}

--- winbindd_rpc.c.orig Wed Jun  5 23:52:44 2002
+++ winbindd_rpc.c  Thu Jun  6 20:22:23 2002
 -206,6 +206,7 
DOM_SID *sids = NULL;
uint32 *types = NULL;
const char *full_name;
+   fstring dos_name;

if (!(mem_ctx = talloc_init_named(name_to_sid[rpc] for [%s]\\[%s], 
domain-name, name))) {
DEBUG(0, (talloc_init failed!\n));
 -216,8 +217,9 
talloc_destroy(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
-
-   full_name = talloc_asprintf(mem_ctx, %s\\%s, domain-name, name);
+fstrcpy(dos_name,name);
+   unix_to_dos(dos_name);
+   full_name = talloc_asprintf(mem_ctx, %s\\%s, domain-name, 
dos_name);

if (!full_name) {
DEBUG(0, (talloc_asprintf failed!\n));

The conversion in srv_samr_nt.c is needed to show the correct group list in 
the ACL-add dialogue. The conversion in lsa_srv_nt.c is needed to set a new 
ACL entry in unix codepage after selecting it from the list.
The change in winbind_rpc.c is needed to get wbinfo -n working.

...Juergen





Re: known BUG multi-byte character set in usernames

2002-06-05 Thread Juergen Hasch

Am Mittwoch, 5. Juni 2002 23:48 schrieb Jeremy Allison:
 On Sun, Jun 02, 2002 at 07:44:02PM +0200, Juergen Hasch wrote:
  Hi Jerry,
 
  Am Sonntag, 2. Juni 2002 03:15 schrieb Gerald Carter:
   On Fri, 31 May 2002, Juergen Hasch wrote:
Now I never would have brought this up because I don't care to much
for 2.2 and I was just curious when I made the patches. But since
someone asked :-) The names/groups are transferred by rpc and
converted from unicode like this: unistr2_to_ascii(t,
info1.str[j].uni_acct_name, sizeof(pstring)); Adding the line
dos_to_unix(t);
makes the umlaute appear.
Now the charset conversion may be totally wrong there, I believed it
to be *easiest* patch.
  
   please send me thispatch for 2.2 if you ave it.  Thanks.
 
  I believe the most simple patch would be:
 
  --- lib/util_unistr.c.orig  Tue Apr  2 18:27:59 2002
  +++ lib/util_unistr.c   Sun Jun  2 14:01:57 2002
   -311,7 +311,7 
 
   /***
Convert a (little-endian) UNISTR2 structure to an ASCII string
  - Warning: this version does DOS codepage.
  + Warning: this version does UNIX codepage.
   /
 
   void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen)
   -335,7 +335,7 
 
  for (p = dest; (p-dest  maxlen-3)  (src - str-buffer 
  str-uni_str_len)  *src; src++) {
  uint16 ucs2_val = SVAL(src,0);
  -   uint16 cp_val = ucs2_to_doscp[ucs2_val];
  +   uint16 cp_val = ucs2_to_unixcp[ucs2_val];
 
  if (cp_val  256)
  *p++ = (char)cp_val;
 
  However, unistr2_to_ascii is used in the printing stuff, too and I don't
  want to mess with this mess :-)
  A less radical patch is attached therefore, adding a new function
  unistr2_to_unix which returns the unix charset instead of the dos
  codepage. Also unistr2_tdup is changed to call unistr2_to_unix. It is
  only used in nsswitch/winbind_rpc.c.

 I've just committed a modified version of this patch to SAMBA_2_2,
 if you could test it out I'd appreciate it.

 Thanks a *lot* for this patch !

 Jeremy.

the patch works fine for except for one thing. In the acl security selection 
list (showing a list of all available users and groups) the german umlaut 
characters are wrong. This is because the unix charset is sent to the windows 
client, as no conversion back takes place.
The acl dialogue itself is ok.

I haven't found out yet, where the conversion back to dos code page should 
take place. Do you have an idea ?

...Juergen





Re: known BUG multi-byte character set in usernames

2002-06-02 Thread Juergen Hasch

Hi Jerry,
Am Sonntag, 2. Juni 2002 03:15 schrieb Gerald Carter:
 On Fri, 31 May 2002, Juergen Hasch wrote:
  Now I never would have brought this up because I don't care to much for
  2.2 and I was just curious when I made the patches. But since someone
  asked :-) The names/groups are transferred by rpc and converted from
  unicode like this: unistr2_to_ascii(t, info1.str[j].uni_acct_name,
  sizeof(pstring)); Adding the line
  dos_to_unix(t);
  makes the umlaute appear.
  Now the charset conversion may be totally wrong there, I believed it to
  be *easiest* patch.

 please send me thispatch for 2.2 if you ave it.  Thanks.

I believe the most simple patch would be:

--- lib/util_unistr.c.orig  Tue Apr  2 18:27:59 2002
+++ lib/util_unistr.c   Sun Jun  2 14:01:57 2002
 -311,7 +311,7 

 /***
  Convert a (little-endian) UNISTR2 structure to an ASCII string
- Warning: this version does DOS codepage.
+ Warning: this version does UNIX codepage.
 /

 void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen)
 -335,7 +335,7 

for (p = dest; (p-dest  maxlen-3)  (src - str-buffer  
str-uni_str_len)  *src; src++) {
uint16 ucs2_val = SVAL(src,0);
-   uint16 cp_val = ucs2_to_doscp[ucs2_val];
+   uint16 cp_val = ucs2_to_unixcp[ucs2_val];

if (cp_val  256)
*p++ = (char)cp_val;

However, unistr2_to_ascii is used in the printing stuff, too and I don't want 
to mess with this mess :-)
A less radical patch is attached therefore, adding a new function 
unistr2_to_unix which returns the unix charset instead of the dos codepage.
Also unistr2_tdup is changed to call unistr2_to_unix. It is only used in 
nsswitch/winbind_rpc.c.

This patch works for me, I can see all umlaute, see/set them under Linux and 
Windows. I am really happy with this :-)

...Juergen
 

--- lib/util_unistr.c.orig	Tue Apr  2 18:27:59 2002
+++ lib/util_unistr.c	Sun Jun  2 17:48:56 2002
 -349,6 +349,45 
 }
 
 /***
+ Convert a (little-endian) UNISTR2 structure to an ASCII string
+ Warning: this version does UNIX codepage.
+/
+
+void unistr2_to_unix(char *dest, const UNISTR2 *str, size_t maxlen)
+{
+	char *p;
+	uint16 *src;
+	size_t len;
+
+	if (str == NULL) {
+		*dest='\0';
+		return;
+	}
+
+	src = str-buffer;
+
+	len = MIN(str-uni_str_len, maxlen);
+	if (len == 0) {
+		*dest='\0';
+		return;
+	}
+
+	for (p = dest; (p-dest  maxlen-3)  (src - str-buffer  str-uni_str_len)  *src; src++) {
+		uint16 ucs2_val = SVAL(src,0);
+		uint16 cp_val = ucs2_to_unixcp[ucs2_val];
+
+		if (cp_val  256)
+			*p++ = (char)cp_val;
+		else {
+			*p++ = (cp_val  8)  0xff;
+			*p++ = (cp_val  0xff);
+		}
+	}
+	
+	*p = 0;
+}
+
+/***
  duplicate a UNISTR2 string into a null terminated char*
  using a talloc context
 /
--- rpcclient/samsync.c.orig	Thu Dec 20 23:33:21 2001
+++ rpcclient/samsync.c	Sun Jun  2 17:54:48 2002
 -78,7 +78,7 
 
 a = deltas[i].account_info;
 
-unistr2_to_ascii(acct_name, a-uni_acct_name,
+unistr2_to_unix(acct_name, a-uni_acct_name,
  sizeof(acct_name) - 1);
 
 /* Decode hashes from password hash */
--- rpcclient/cmd_srvsvc.c.orig	Wed Apr  3 05:54:39 2002
+++ rpcclient/cmd_srvsvc.c	Sun Jun  2 17:54:22 2002
 -142,8 +142,8 
 	fstring name;
 	fstring comment;
 
-	unistr2_to_ascii(name, sv101-uni_name, sizeof(name) - 1);
-	unistr2_to_ascii(comment, sv101-uni_comment, sizeof(comment) - 1);
+	unistr2_to_unix(name, sv101-uni_name, sizeof(name) - 1);
+	unistr2_to_unix(comment, sv101-uni_comment, sizeof(comment) - 1);
 
 	display_server(name, sv101-srv_type, comment);
 
 -160,9 +160,9 
 	fstring comment;
 	fstring usr_path;
 	
-	unistr2_to_ascii(name, sv102-uni_name, sizeof(name) - 1);
-	unistr2_to_ascii(comment, sv102-uni_comment, sizeof(comment) - 1);
-	unistr2_to_ascii(usr_path, sv102-uni_usr_path, sizeof(usr_path) - 1);
+	unistr2_to_unix(name, sv102-uni_name, sizeof(name) - 1);
+	unistr2_to_unix(comment, sv102-uni_comment, sizeof(comment) - 1);
+	unistr2_to_unix(usr_path, sv102-uni_usr_path, sizeof(usr_path) - 1);
 
 	display_server(name, sv102-srv_type, comment);
 
--- rpcclient/cmd_samr.c.orig	Wed Apr  3 05:54:39 2002
+++ rpcclient/cmd_samr.c	Sun Jun  2 17:53:18 2002
 -37,31 +37,31 
 	unistr2_to_ascii(temp, usr-uni_user_name, sizeof(temp)-1);
 	printf(\tUser Name   :\t%s\n, temp);
 	
-	unistr2_to_ascii(temp, usr-uni_full_name, sizeof(temp)-1);
+	unistr2_to_unix(temp, usr-uni_full_name, sizeof(temp)-1);
 	printf(\tFull Name   :\t%s\n, temp

Re: VFS problem

2002-06-02 Thread Juergen Hasch

Hi Jim,

Am Samstag, 1. Juni 2002 18:25 schrieb Jim Myers:
 I'm trying to write a VFS module that uses the conn-vfs_private problem.
 It appears this field is never referenced in existing Samba code and is NOT
 initialized in vfs.c:vfs_init_custom.

 It appears to me that this function needs the following line added:
   conn-vfs_private = NULL;

 However there is a further design problem. There is no way for a custom VFS
 to properly initialize and cleanup as there is no first-time call that
 allows access to the conn structure, nor is there a cleanup call to free
 any memory pointed to by vfs_private.

 I would think it would be could to add the conn structure as a parameter to
 the custom VFS init function: vfs_init and and a new cleanup call as well
 so the associated memory could be freed.

 Jim Myers
 IBM Almaden Research Center
 B3-239, 408-927-2013

what's the problem with conn-vfs_private not being initialized ?
You can start using it on connect and don't have to worry about it's contents. 
And you clean it up on disconnect. 

In my recycle bin module for Samba 2_2 I'm using vfs_private like this:

static int recycle_connect(struct connection_struct *conn, const char 
*service, const char *user)
{
TALLOC_CTX *ctx=NULL;

if (!(ctx = talloc_init_named(recycle bin))) {
DEBUG(0, (Failed to allocate memory in VFS module recycle_bin\n));
return 0;
}
conn-vfs_private= (void *)ctx;
return 0;
}

static void recycle_disconnect(struct connection_struct *conn)
{
talloc_destroy((TALLOC_CTX *)conn-vfs_private);
default_vfs_ops.disconnect(conn);
}

...Juergen






Re: VFS problem

2002-06-02 Thread Juergen Hasch

Hi Jim,

Am Sonntag, 2. Juni 2002 22:58 schrieb Jim Myers:
 I was aware of that, but from the traces I took (with log level=10),
 connect was sometimes NOT called!
 I saw examples where after Samba was restarted and I tried to access a file
 in the VFS share, the first call after vfs_init was an open.

 So that strategy did not work (using Samba 3.0alpha17)

then this is clearly a bug. What I did for testing was to create a persistent
structure in connect(), which gets deleted in disconnect(). When a vfs 
function is called, it searches a linked list of persistent objects until it 
finds it's connection number SNUM(conn).

...Juergen






Re: known BUG multi-byte character set in usernames

2002-05-31 Thread Juergen Hasch

Am Freitag, 31. Mai 2002 11:58 schrieb Andrew Bartlett:
 Juergen Hasch wrote:
 
  I will generate a complete patch if the Samba team thinks it's worth
  considering and I am not completely on the wrong track :-)

 What the heck are you trying here?

The problem is like this:
Without patch:
hasch@tower:~ getent passwd
...
DOMAIN\juhasch:x:10004:1:Jrgen Hasch:/home/DOMAIN/juhasch:/bin/false
...

with patch:
hasch@tower:~ getent passwd
...
DOMAIN\juhasch:x:10004:1:Jürgen Hasch:/home/DOMAIN/juhasch:/bin/false
...

i.e. I get the full user name including umlaute. This also shows up in the 
windows client's security settings correct now.

Now I never would have brought this up because I don't care to much for 2.2 
and I was just curious when I made the patches. But since someone asked :-)
The names/groups are transferred by rpc and converted from unicode like this:
unistr2_to_ascii(t, info1.str[j].uni_acct_name, sizeof(pstring));
Adding the line
dos_to_unix(t);
makes the umlaute appear.
Now the charset conversion may be totally wrong there, I believed it to be 
*easiest* patch.

 Can you resend me the patch you were doing for HEAD, and I'll try to get
 that in.  In the meantime, this looks bogus.

In a few minutes.

...Juergen






Re: known BUG multi-byte character set in usernames

2002-05-30 Thread Juergen Hasch

Hi Guenther,

Am Donnerstag, 30. Mai 2002 16:17 schrieb Guenther Deschner:
 hello,

 smb.conf-manpage of 2.2.5pre and HEAD states the bug of multi-byte
 character sets in usernames:

 -8--snip--8--
 BUG: There is currently a bug  in  the  implementation  of
security = domain with respect to multi-byte character set
usernames. The communication with a Domain Controller must
be  done  in  UNICODE  and  Samba currently does not widen
multi-byte user names to UNICODE correctly, thus a  multi-
byte  username  will  not  be  recognized correctly at the
Domain Controller. This  issue  will  be  addressed  in  a
future release.
 -8--snap--8--

 will this bug be solved in the near future? in 2.2.5 or HEAD?

 the main problem with this is that you get crippled wellknown
 domain-groups with winbind (on suse linux 8, kernel 2.4.18, samba-2_2)
 and german NT-servers where rid200 (Domain Admins) is Domänen-Admins,
 and rid202 is Domänen-Gäste.

 now wbinfo -g cuts out the UTF8 chars and will show you e.g.
 DOMAIN+Domnen-Admins, DOMAIN+Domnen-Gste, etc.

 now you cannot set XFS-ACLs properly since neither DOMAIN+Domnen-Admins
 nor DOMAIN+Domänen-Admins does resolve back ...

 a simple (and ugly) workaround is to create the three domain-groups in
 question in /etc/group. with that you still have to keep an eye on the
 correct winbind-gid mapping and rid200 appears crippled in security tab.

 is there any other workaround for this?

I believe this is a different problem. There is just no conversion of group 
and user names to the desired character set.
With the patch below applied I get:
hasch@tower:~ getent group
...
DOMAIN\Domänen-Admins:x:10003:DOMAIN\Administrator,DOMAIN\testadmin
DOMAIN\Domänen-Gäste:x:10004:DOMAIN\Gast 
DOMAIN\Domänencomputer:x:10005:
DOMAIN\Domänencontroller:x:10006:
...

Now the correct usernames and groups are shown. I only added a few 
conversions, the correct approach would be to check all
unistr2_to_ascii calls and add dos_to_unix where neccessary.

I will generate a complete patch if the Samba team thinks it's worth
considering and I am not completely on the wrong track :-)

...Juergen


--- nsswitch/winbindd_rpc.c.orig	Thu May 30 16:25:50 2002
+++ nsswitch/winbindd_rpc.c	Sat May 25 23:49:43 2002
 -63,7 +63,7 
 		uint32 count = 0, start=i;
 		int j;
 		TALLOC_CTX *ctx2;
-
+		pstring t;
 		ctr.sam.info1 = info1;
 
 		ctx2 = talloc_init_named(winbindd dispinfo);
 -92,8 +92,14 
 		}
 
 		for (j=0;jcount;i++, j++) {
-			(*info)[i].acct_name = unistr2_tdup(mem_ctx, info1.str[j].uni_acct_name);
-			(*info)[i].full_name = unistr2_tdup(mem_ctx, info1.str[j].uni_full_name);
+			unistr2_to_ascii(t, info1.str[j].uni_acct_name, sizeof(pstring));
+			dos_to_unix(t);
+			(*info)[i].acct_name = talloc_strdup(mem_ctx, t);
+			
+			unistr2_to_ascii(t, info1.str[j].uni_full_name, sizeof(pstring));
+			dos_to_unix(t);
+			(*info)[i].full_name = talloc_strdup(mem_ctx, t);
+			
 			(*info)[i].user_rid = info1.sam[j].rid_user;
 			/* For the moment we set the primary group for
 			   every user to be the Domain Users group.
 -267,6 +273,7 
 	POLICY_HND dom_pol, user_pol;
 	BOOL got_dom_pol = False, got_user_pol = False;
 	SAM_USERINFO_CTR *ctr;
+	pstring t;
 
 	/* Get sam handle */
 	if (!(hnd = cm_get_sam_handle(domain-name)))
 -300,10 +307,20 
 	got_user_pol = False;
 
 	user_info-group_rid = ctr-info.id21-group_rid;
-	user_info-acct_name = unistr2_tdup(mem_ctx, 
-	ctr-info.id21-uni_user_name);
-	user_info-full_name = unistr2_tdup(mem_ctx, 
-	ctr-info.id21-uni_full_name);
+	
+	unistr2_to_ascii(t, ctr-info.id21-uni_user_name, sizeof(pstring));
+	dos_to_unix(t);
+	user_info-acct_name = talloc_strdup(mem_ctx, t);
+	
+	unistr2_to_ascii(t, ctr-info.id21-uni_full_name, sizeof(pstring));
+	dos_to_unix(t);
+	user_info-full_name = talloc_strdup(mem_ctx, t);
+
 
  done:
 	/* Clean up policy handles */
--- libsmb/cli_samr.c.orig	Thu May 30 16:30:33 2002
+++ libsmb/cli_samr.c	Sat May 25 23:30:51 2002
 -569,6 +569,7 
 			unistr2_to_ascii((*dom_groups)[i].acct_name,
 	 r.uni_grp_name[name_idx],
 	 sizeof(fstring) - 1);
+			dos_to_unix((*dom_groups)[i].acct_name);
 			name_idx++;
 		}
 
 -647,6 +648,7 
 			unistr2_to_ascii((*dom_groups)[i].acct_name,
 	 r.uni_grp_name[name_idx],
 	 sizeof(fstring) - 1);
+			dos_to_unix((*dom_groups)[i].acct_name);
 			name_idx++;
 		}
 
 -938,6 +940,7 
 		fstring tmp;
 
 		unistr2_to_ascii(tmp, r.uni_name[i], sizeof(tmp) - 1);
+		dos_to_unix(tmp);
 		(*names)[i] = talloc_strdup(mem_ctx, tmp);
 		(*name_types)[i] = r.type[i];
 	}
--- rpcclient/cmd_samr.c.orig	Sun Apr  7 10:10:35 2002
+++ rpcclient/cmd_samr.c	Thu May 30 16:38:36 2002
 -35,9 +35,11 
 	fstring temp;
 
 	unistr2_to_ascii(temp, usr-uni_user_name, sizeof(temp)-1);
+	dos_to_unix(temp);
 	printf(\tUser Name   :\t%s\n, temp);
 	
 	unistr2_to_ascii(temp, 

Warning in trans2.c under AIX

2002-05-30 Thread Juergen Hasch

When compiling Samba 2_2 CVS under AIX 4.3.3 using gcc or xlc_r, I get the following 
warnings:

smbd/trans2.c: In function `get_lanman2_dir_entry':
smbd/trans2.c:759: warning: right shift count = width of type
smbd/trans2.c:759: warning: right shift count = width of type
smbd/trans2.c:759: warning: right shift count = width of type
smbd/trans2.c:759: warning: right shift count = width of type
smbd/trans2.c: In function `call_trans2qfilepathinfo':
smbd/trans2.c:2025: warning: right shift count = width of type
smbd/trans2.c:2025: warning: right shift count = width of type
smbd/trans2.c:2025: warning: right shift count = width of type
smbd/trans2.c:2025: warning: right shift count = width of type

The first offending line in smbd/trans2.c is:
SOFF_T(p,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk 
- 64 Bit */

sbuf.st_blocks is of type blksize_t which is defined as int with only 32 bits and 
STAT_ST_BLOCKSIZE=512.

The SOFF_T macro is defined as:
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)0x), SIVAL(p,(ofs)+4,(v)32))

The value passed to SOFF_T needs to be a 64 bit value, attached is a patch I use to 
silence the compiler.

...Juergen



--- smbd/trans2.c.orig	Thu May 30 23:16:44 2002
+++ smbd/trans2.c	Thu May 30 23:16:59 2002
 -756,7 +756,7 
 			p+= 8;
 
 #if defined(HAVE_STAT_ST_BLOCKS)  defined(STAT_ST_BLOCKSIZE)
-			SOFF_T(p,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
+			SOFF_T(p,0,((long long)sbuf.st_blocks)*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
 #else
 			/* Can't get the value - fake it using size. */
 			SOFF_T(p,0,sbuf.st_size); /* Number of bytes used on disk - 64 Bit */
 -2022,7 +2022,7 
 		pdata += 8;
 
 #if defined(HAVE_STAT_ST_BLOCKS)  defined(STAT_ST_BLOCKSIZE)
-		SOFF_T(pdata,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
+		SOFF_T(pdata,0,(long long)sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
 #else
 		/* Can't get the value - fake it using size. */
 		SOFF_T(pdata,0,sbuf.st_size); /* Number of bytes used on disk - 64 Bit */



Re: [PATCH]Make VFS modules work under Solaris and AIX

2002-05-20 Thread Juergen Hasch

Am Montag, 20. Mai 2002 01:18 schrieb Juergen Hasch:
 Am Montag, 20. Mai 2002 00:56 schrieb Juergen Hasch:
  Hi,
  attached is a patch and a few new files to make VFS modules work under
  Solaris and AIX.
  I have tested it with Solaris 8 using gcc and Sun Workshop cc. For AIX I
  tested it with gcc and xlc_r. Linux still works, too :-)
 
  samba_core.patch changes configure.in and Makefile.in in the samba source
  directory. The patch is needed to access symbols within smbd from a VFS
  module.
  The files configure.in and Makefile.in go to the examples/VFS directory.
  After running autoconf you can execute configure to create a new Makefile
  which will have the correct settings for Linux, AIX and Solaris.

 Oops, actually I only wanted to save the message to my drafts folder and
 send it after some sleep. But here is the patch anyway...
 It applies to SAMBA_2_2 CVS.

Here are the slightly updated patches for Samba HEAD.
Makefile.in.patch and configure.in.patch apply to samba/source, Makefile.in 
and configure.in go to samba/examples/VFS.

...Juergen


##
# Makefile.in for Samba VFS modules 
###

CC=@CC
LIBTOOL=@LIBTOOL
CFLAGS=@CFLAGS
LDFLAGS=@LDFLAGS
INSTALLDIR=@INSTALLDIR

VFS_OBJS=audit.so skel.so recycle.so

SHELL=/bin/sh

default: $(VFS_OBJS)

# Pattern rules

%.so: %.lo
	$(LIBTOOL) --mode=link $(CC) -o $ $ $(LDFLAGS)

%.lo: %.c
	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $

# Misc targets

clean:
	rm -rf .libs
	rm -f core *~ *% *.bak \
		$(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) 

install:
	echo Installing shared libraries in $(INSTALLDIR)
	for i in $(VFS_OBJS) ; do \
		install $$i $(INSTALLDIR) ; \
	done


--- Makefile.in.orig	Sat May 18 16:01:27 2002
+++ Makefile.in	Mon May 20 17:17:08 2002
 -14,6 +14,7 
 CFLAGS=@CFLAGS
 CPPFLAGS=@CPPFLAGS
 LDFLAGS=@LDFLAGS
+SMBD_LDFLAGS=@SMBD_LDFLAGS
 LDSHFLAGS=@LDSHFLAGS LDFLAGS CFLAGS
 AWK=@AWK
 DYNEXP=@DYNEXP
 -571,7 +572,7 
 
 bin/smbd: $(SMBD_OBJ) bin/.dummy
 	echo Linking $
-	$(CC) $(FLAGS) -o $ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) 
+	$(CC) $(FLAGS) -o $ $(SMBD_OBJ) $(SMBD_LDFLAGS) $(LDFLAGS) $(DYNEXP) $(LIBS) 
 
 bin/nmbd: $(NMBD_OBJ) bin/.dummy
 	echo Linking $


--- configure.in.orig	Fri May 17 17:00:33 2002
+++ configure.in	Mon May 20 22:30:19 2002
 -153,6 +153,7 
 AC_SUBST(RUNPROG)
 AC_SUBST(MPROGS)
 AC_SUBST(LDSHFLAGS)
+AC_SUBST(SMBD_LDFLAGS)
 AC_SUBST(SHLD)
 AC_SUBST(HOST_OS)
 AC_SUBST(PAM_MOD)
 -860,6 +861,7 
 # these are the defaults, good for lots of systems
 HOST_OS=$host_os
 LDSHFLAGS=-shared
+SMBD_LDFLAGS=
 SHLD=\${CC}
 PICFLAG=
 PICSUFFIX=po
 -884,6 +886,7 
 			LDSHFLAGS=-h \$ -G
 			if test ${GCC} = yes; then
 PICFLAG=-fPIC
+SMBD_LDFLAGS=-Wl,-E
 			else
 PICFLAG=-KPIC
 POBAD_CC=
 -921,7 +924,13 
 		*aix*) AC_DEFINE(AIX)
 			BLDSHARED=true
 			LDSHFLAGS=-Wl,-bexpall,-bM:SRE,-bnoentry
-			PICFLAG=-O2 -qmaxmem=6000
+			SMBD_LDFLAGS=-Wl,-brtl,-bexpall
+			if test ${GCC} = yes; then
+PICFLAG=-O2
+			else 
+PICFLAG=-O2 -qmaxmem=6000
+			fi
+			
 			AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
 		;;
 		*hpux*) AC_DEFINE(HPUX)
 -978,6 +987,8 
 AC_MSG_RESULT($BLDSHARED)
 AC_MSG_CHECKING([linker flags for shared libraries])
 AC_MSG_RESULT([$LDSHFLAGS])
+AC_MSG_CHECKING([linker flags for smbd])
+AC_MSG_RESULT([$SMBD_LDFLAGS])
 AC_MSG_CHECKING([compiler flags for position-independent code])
 AC_MSG_RESULT([$PICFLAGS])
 
 -2672,6 +2683,9 
 	*hpux11*)
 		HAVE_WINBIND=yes
 		WINBIND_NSS_EXTRA_OBJS=nsswitch/winbind_nss_solaris.o
+		;;
+	*aix4*)
+ 		HAVE_WINBIND=yes
 		;;
 	*)
 		HAVE_WINBIND=no


dnl Samba VFS Modules

AC_INIT

uname=`uname`

# include dirs
SAMBA_SRC=../../source
SAMBA_INCL=$SAMBA_SRC/include
UBIQX_SRC=$SAMBA_SRC/ubiqx
SMBWR_SRC=$SAMBA_SRC/smbwrapper
CFLAGS=-I$SAMBA_SRC -I$SAMBA_INCL -I$UBIQX_SRC -I$SMBWR_SRC

dnl Check programs needed
AC_PROG_CC

dnl ensure libtool is installed
AC_PATH_PROG(LIBTOOL, libtool,,)
if test $LIBTOOL = ; then
echo
echo 'FATAL ERROR: libtool does not seem to be installed.'
echo $pkg_name cannot be built without a working libtool installation.
exit 1
fi

dnl check in which directory to install
AC_PREFIX_DEFAULT(/usr/local/samba)

if test $prefix = NONE ; then
  prefix=$ac_default_prefix
fi

AC_ARG_WITH(installdir,
[--with-installdir=DIR   Set .so install directory (default=$prefix/lib)],
INSTALLDIR=$withval,
INSTALLDIR=$prefix/lib)
AC_SUBST(INSTALLDIR)

AC_ARG_WITH(krb5,
[--with-krb5=DIR Set Kerberos 5 include file directory],
CFLAGS=$CFLAGS -I$withval,)

#
# Config CFLAGS settings
#

case $uname in
AIX)
if test ${GCC} = yes; then
CFLAGS=$CFLAGS -Wall -I/usr/include -D_LINUX_SOURCE_COMPAT
else
CFLAGS=$CFLAGS -D_LINUX_SOURCE_COMPAT
fi
;;
SunOS

Re: [PATCH]Make VFS modules work under Solaris and AIX

2002-05-19 Thread Juergen Hasch

Am Montag, 20. Mai 2002 00:56 schrieb Juergen Hasch:
 Hi,
 attached is a patch and a few new files to make VFS modules work under
 Solaris and AIX.
 I have tested it with Solaris 8 using gcc and Sun Workshop cc. For AIX I
 tested it with gcc and xlc_r. Linux still works, too :-)

 samba_core.patch changes configure.in and Makefile.in in the samba source
 directory. The patch is needed to access symbols within smbd from a VFS
 module.
 The files configure.in and Makefile.in go to the examples/VFS directory.
 After running autoconf you can execute configure to create a new Makefile
 which will have the correct settings for Linux, AIX and Solaris.

Oops, actually I only wanted to save the message to my drafts folder and send 
it after some sleep. But here is the patch anyway...
I applies to SAMBA_2_2 CVS.


--- Makefile.in.orig	Fri May  3 03:02:26 2002
+++ Makefile.in	Sat May 18 21:08:58 2002
 -14,6 +14,7 
 CFLAGS=@CFLAGS
 CPPFLAGS=@CPPFLAGS
 LDFLAGS=@LDFLAGS
+SMBD_LDFLAGS=@SMBD_LDFLAGS
 AWK=@AWK
 DYNEXP=@DYNEXP
 
 -505,7 +506,7 
 
 bin/smbd: $(SMBD_OBJ) bin/.dummy
 	echo Linking $
-	$(CC) $(FLAGS) -o $ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) 
+	$(CC) $(FLAGS) -o $ $(SMBD_OBJ) $(SMBD_LDFLAGS) $(LDFLAGS) $(DYNEXP) $(LIBS) 
 
 bin/nmbd: $(NMBD_OBJ) bin/.dummy
 	echo Linking $
--- configure.in.orig	Sat May 18 22:48:59 2002
+++ configure.in	Mon May 20 01:00:52 2002
 -152,6 +152,7 
 AC_SUBST(RUNPROG)
 AC_SUBST(MPROGS)
 AC_SUBST(LDSHFLAGS)
+AC_SUBST(SMBD_LDFLAGS)
 AC_SUBST(SONAMEFLAG)
 AC_SUBST(SHLD) 
 AC_SUBST(HOST_OS)
 -831,6 +832,7 
 # these are the defaults, good for lots of systems
 HOST_OS=$host_os
 LDSHFLAGS=-shared
+SMBD_LDFLAGS=
 SONAMEFLAG=#
 SHLD=\${CC} 
 PICFLAG=
 -855,6 +857,7 
 			LDSHFLAGS=-G
 			SONAMEFLAG=-h 
 			if test ${GCC} = yes; then
+SMBD_LDFLAGS=-Wl,-E
 PICFLAG=-fPIC
 			else
 PICFLAG=-KPIC
 -866,8 +869,12 
 		*sunos*) AC_DEFINE(SUNOS4)
 			BLDSHARED=true
 			LDSHFLAGS=-G
+			if test ${GCC} = yes; then
+PICFLAG=-fPIC -DPIC
+			else 
+PICFLAG=-KPIC
+			fi
 			SONAMEFLAG=-Wl,-h,
-			PICFLAG=-KPIC   # Is this correct for SunOS
 		;;
 		*bsd*)  BLDSHARED=true
 			LDSHFLAGS=-shared
 -896,7 +903,13 
 		*aix*) AC_DEFINE(AIX)
 			BLDSHARED=true
 			LDSHFLAGS=-Wl,-bexpall,-bM:SRE,-bnoentry
-			PICFLAG=-O2 -qmaxmem=6000
+			SMBD_LDFLAGS=-Wl,-brtl,-bexpall
+			if test ${GCC} = yes; then
+PICFLAG=-O2
+			else 
+PICFLAG=-O2 -qmaxmem=6000
+			fi
+			
 			AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
 		;;
 		*hpux*) AC_DEFINE(HPUX)
 -950,6 +963,8 
 AC_MSG_RESULT($BLDSHARED)
 AC_MSG_CHECKING([linker flags for shared libraries])
 AC_MSG_RESULT([$LDSHFLAGS])
+AC_MSG_CHECKING([linker flags for smbd])
+AC_MSG_RESULT([$SMBD_LDFLAGS])
 AC_MSG_CHECKING([compiler flags for position-independent code])
 AC_MSG_RESULT([$PICFLAGS])
 
 -2649,6 +2664,9 
 	*hpux11*)
 		HAVE_WINBIND=yes
 		WINBIND_NSS_EXTRA_OBJS=nsswitch/winbind_nss_solaris.o
+		;;
+	*aix4*)
+ 		HAVE_WINBIND=yes
 		;;
 *)
 		HAVE_WINBIND=no


##
# Makefile.in for Samba VFS modules 
###

CC=@CC
LIBTOOL=@LIBTOOL
CFLAGS=@CFLAGS
LDFLAGS=@LDFLAGS

VFS_OBJS=audit.so skel.so recycle.so

SHELL=/bin/sh

default: $(VFS_OBJS)

# Pattern rules

%.so: %.lo
	$(LIBTOOL) --mode=link $(CC) -o $ $ $(LDFLAGS)

%.lo: %.c
	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $

# Misc targets

clean:
	rm -rf .libs
	rm -f core *~ *% *.bak \
		$(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) 



dnl Samba VFS Modules

AC_INIT

uname=`uname`

dnl Check programs needed
AC_PROG_CC

dnl ensure libtool is installed
AC_PATH_PROG(LIBTOOL, libtool,,)
if test $LIBTOOL = ; then
echo
echo 'FATAL ERROR: libtool does not seem to be installed.'
echo $pkg_name cannot be built without a working libtool installation.
exit 1
fi

#
# Config CFLAGS settings
#
CFLAGS=-Wall

case $uname in
AIX)
if test ${GCC} = yes; then
CFLAGS=$CFLAGS -I/usr/include -D_LINUX_SOURCE_COMPAT
else
CFLAGS=-D_LINUX_SOURCE_COMPAT
fi
;;
SunOS)
if test ${GCC} = yes; then
CFLAGS=$CFLAGS
else
CFLAGS=
fi
;;  
#   Linux)
#   CFLAGS=-Wall
#   ;;
esac

#
# Config LDLAGS settings
#
LDFLAGS=-shared

case $uname in
AIX)
LDFLAGS=-Wl,-G,-bexpall,-bnoentry
;;
SunOS)
LDFLAGS=-G
;;
#   Linux)
#   echo Linux found
#   LDFLAGS=-shared
#   ;;
esac

#
# Check to see if we should use the included popt

AC_ARG_WITH(included-popt,
[  --with-included-poptuse bundled popt library, not from system

winbind authentication

2002-05-12 Thread Juergen Hasch

Hi,

this problem applies to 2.2.4 and partly to head, too.

I need to set a username when connecting to a Win2K server using winbind.
The documentiation states wbinfo -A user%password would do the trick.

However this doesn't work. For wbinfo in 2.2.4:
- the -A option is documented, but isn't working.
  (--set-auth-user is the actual name of the command but this is undocumented)
- secrets_init() isn't called so secrets.tdb isn't open.
- the username variable instead of user is stored (which is user%password
  instead of user alone)
The patch below makes it work for me. In head the same patch can be applied,
with the exception of secrets_init() not being needed.

...Juergen 

--- nsswitch/wbinfo.origFri May  3 03:03:20 2002
+++ nsswitch/wbinfo.c   Sat May 11 18:30:06 2002
 -592,9 +592,9 
password = ;
 
/* Store in secrets.tdb */
-
-   if (!secrets_store(SECRETS_AUTH_USER, username, 
-  strlen(username) + 1) ||
+   secrets_init();
+   if (!secrets_store(SECRETS_AUTH_USER, user, 
+  strlen(user) + 1) ||
!secrets_store(SECRETS_AUTH_DOMAIN, domain, 
   strlen(domain) + 1) ||
!secrets_store(SECRETS_AUTH_PASSWORD, password,
 -640,6 +640,7 
printf(\t-m\t\t\tlist trusted domains\n);
printf(\t-r user\t\t\tget user groups\n);
printf(\t-a user%%password\tauthenticate user\n);
+   printf(\t-A user%%password\tstore user and password used by winbind (root 
only)\n);
printf(\t-p 'ping' winbindd to see if it is alive\n);
printf(\t--sequence\t\tshow sequence numbers of all domains\n);
 }
 -683,7 +684,7 
{ sequence, 0, POPT_ARG_NONE, 0, OPT_SEQUENCE },
{ user-groups, 'r', POPT_ARG_STRING, string_arg, 'r' },
{ authenticate, 'a', POPT_ARG_STRING, string_arg, 'a' },
-   { set-auth-user, 0, POPT_ARG_STRING, string_arg, OPT_SET_AUTH_USER 
},
+   { set-auth-user, 'A', POPT_ARG_STRING, string_arg, 
+OPT_SET_AUTH_USER },
{ ping, 'p', POPT_ARG_NONE, 0, 'p' },
{ 0, 0, 0, 0 }
};





Re: winbind authentication

2002-05-12 Thread Juergen Hasch

Hi Noel,

Am Sonntag, 12. Mai 2002 13:39 schrieb Noel Kelly:
 Downloaded 2.2.4 yesterday and it without your patch it works for me:

 [noel@belly noel]$ wbinfo -a uk+nkelly%password
 plaintext password authentication succeeded
 error code was NT_STATUS_OK (0x0)
 challenge/response password authentication succeeded
 error code was NT_STATUS_OK (0x0)
 [noel@belly noel]$
 [noel@belly noel]$ wbinfo -a uk+nkelly%wrongpassword
 plaintext password authentication failed
 error code was NT_STATUS_WRONG_PASSWORD (0xc06a)
 Could not authenticate user uk+nkelly%password with plaintext password
 challenge/response password authentication failed
 error code was NT_STATUS_WRONG_PASSWORD (0xc06a)
 Could not authenticate user uk+nkelly with challenge/response
 [noel@belly noel]$


I think I wasn't clear enough. The problem is that winbind itself is not 
authenticating to the W2K server. Per default winbind uses empty
fields for user and password to connect to the W2K server. You need to
change this sometimes to get user and group lists.
Therefore one needs wbinfo -A user%password to store user and password in 
the secrets tdb.

...Juergen





Re: vfs_private

2002-05-10 Thread Juergen Hasch

Hi Jason,

Am Freitag, 10. Mai 2002 21:23 schrieb Jason Cook:
 I am trying to add support to the recycle_bin module to be able to
 pass the dir mask in and I can't see how to store that as well as the
 path into vfs_private.  Any suggestions as to how I should go about this?

you might want to look at my recycle bin extensions at http://www.elbonia.de.
I added several parameters to the recycle bin.

...Juergen





Re: VFS recycle bin

2002-04-08 Thread Juergen Hasch

Am Montag, 8. April 2002 13:24 schrieb Andrew Bartlett:
  Add -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 to the compiler options
  and it works :-)

 The problem is that the VFS (and passdb for that matter) modules are
 libtool based :-).

 They are not created via the normal makefile system, and don't get the
 same complier options.  In the same way, passdb moudles can't be built
 on RedHat systems without some modification, becouse the kerberos
 headers are not in the right place.

 Yet again we see that libtool is an all or nothing thing ;-)

Couldn't configure.in be changed to supply the defines to config.h instead of 
adding it to CFLAGS in the makefile ?

Most source files (all ?) include config.h via includes.h anyway, so this 
could work.

...Juergen