Question about VFS sample - audit

Ó¢ì¿ ÓÚ yingweiyu at hotmail.com
Sat Feb 16 12:26:01 GMT 2002


Hello,

I am new to this maillist and I have a question towards the VFS in Samba. I 
am trying to update the audit.c by syslog the name of directories from 
readdir(). I have added the following codes to audit.c:

(1) in vfs_init():
     I inserted line: ops->readdir = audit_readdir;

(2) I created the function audit_readdir as follows:

struct dirent *audit_readdir(connection_struct *conn, DIR *dirp)
{
        char *dirname=NULL;
        struct dirent *result;
        int i;
        int l;

        result = default_vfs_ops.readdir(conn, dirp);

	//copy directory name into variable dirname
        l=strlen(result->d_name);
        dirname = alloca((l + 1) * sizeof(char));
        dirname[l]=0;
        for(i=0;i<l;i++)
                dirname[i]=result->d_name[i];

        syslog(SYSLOG_PRIORITY, "reading dir %s\n", dirname);
        return result;
}

When I run this module, the directory names can be sysloged correctly when 
typing "ls". However, it prompts the error in smbclient:

smb: \>ls
code 0 listing \*
read_socket_with_timeout: timeout read. read error = Broken pipe.
Error in dskattr: code 0
smb: \> Broken pipe

and then, system quit smbclient. Could anyone help me to see what happens 
there and how to solve this problem?

Thanks a lot!

-yingwei

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com





More information about the samba-technical mailing list