Monday, January 18, 2010

Re: [nslu2-linux] Hooking SAMBA access to script?

 

Not sure if this would work on the NSLU2 but it should in theory work on a regular Linux system without patching samba (its still not exactly a trivial solution) :

Make the samba port run off a port proxy running from a netcat / named pipe. i.e. make netcat listen on the samba port and write to a named pipe. Read off the named pipe and send data to samba. Also tee the data going into the pipe into another /tmp file. You can find some info on how to set this up on the netcat wikipedia : http://en.wikipedia.org/wiki/Netcat

Once this is done, you need to read off the redirected tmp file (perl is good at reading packed binary data) with your script and try to spot operations that would lead to open requests for files and when it does, call your script!

This works without binary modifications but would require you to read up a little bit on the samba protocol itself (cant help you there because I dont know much about it either).

cheers,
Harsh



From: Mike Westerhof (mwester) <mwester@dls.net>
To: nslu2-linux@yahoogroups.com
Sent: Tue, 19 January, 2010 2:21:50 AM
Subject: Re: [nslu2-linux] Hooking SAMBA access to script?

Mai Kee Reis wrote:
> Hello friends of tiny linux boxes,
>
> I wonder if anybody could give me an advice how to hook some script to
> each fopen(), when initiated by a remote client.
> Currently, I'm running Samba 3.2.8 on a NSLU2 rev.2
> (uname -a: Linux Nslu2.home 2.6.27.8 #1 Sat Mar 7 06:32:59 UTC 2009
> armv5tel unknown unknown GNU/Linux)
>
> The idea is to catch all access to *.mp3 and *.ogg files from user
> 'audioplayer' to create some last played / most played / least played
> playlist files.
> Thus, it's not required to have it in real time.
>
> Of course I asked google (just found a lot "if-down.d hook samba") and
> my local smb.conf (/var/log/samba/log.%m has no filenames).
>
> Any hint? Impossible without patching samba?

Yes, impossible without patching samba.

-Mike (mwester)


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/nslu2-linux/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/nslu2-linux/join
    (Yahoo! ID required)

<*> To change settings via email:
    nslu2-linux-digest@yahoogroups.com
    nslu2-linux-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    nslu2-linux-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/



The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

__._,_.___
.

__,_._,___

No comments:

Post a Comment