Custom named pipes

David Lee t.d.lee at durham.ac.uk
Fri Sep 13 13:50:00 GMT 2002


On Fri, 13 Sep 2002 gerryjacobs at tiscali.be wrote:

> I'm trying to create a linux application which creates a named pipe on
> which a windows machine should connect to.  I checked out the
> smbd/nttrans.c and noticed that a static known_nt_pipes array is used. 
> This array contains all the pipe names which are created by the samba
> server.  Is it possible to add a dynamic array in which you can add
> custom made pipes (eg. via smb.conf)? 

> I can hack the code for myself. But I can hardly believe that I'm the
> only one who need this.  The smbd process should then write the incoming
> data from a 'Windows Named Pipe' to a 'Unix Named Pipe' or keep it
> somewhere in a buffer file, which should be read out by a ReadNamedPipe
> api. This ReadNamedPipe api should be located in the libsmbclient
> library. 
> 
> or...
> 
> am I moving too fast and is there already somewhere in the samba code an
> api which can be called from an external program to create a (server)
> named pipe? 

This sounds related to an idea which we have discussed a couple of times
this year, but in a different context.  Namely, an smbd could have an
associated named-pipe on UNIX, so that writes to that named-pipe would be
translated into WinPopup messages for the client PC .  (I further
suggested that if this pipe were "/dev/smb/<n>", as per utmp, that
standard UNIX utilities such as "wall" and "write" could be used to send
messages (WinPopup) to the client PC.) 

[As a beneficial side-effect, it would also alleviate a problem with
"finger" on some OSes at sites which use Samba's utmp facility.]

It sounds as though your suggestion is a generalisation of my WinPopup
one.  Or, put the other way, that the WinPopup messaging could be a
particular use of your mechanism. 

Scope for symbiosis here!


An initial discussion, but which is very long and protracted, is at:
   http://lists.samba.org/pipermail/samba-technical/2002-January/thread.html
   http://lists.samba.org/pipermail/samba-technical/2002-February/thread.html

under thread
   smbwall


So I would suggest concentrating on the later discussion, which includes
Jeremy Allison's response, sympathetic to the principle:
   http://lists.samba.org/pipermail/samba-technical/2002-June/thread.html

under thread:
   [Fwd: Finger problem on Solaris with 2.2.4 (PR#24659)]"



My "proof of concept" implementation, which worked reasonably well, had
three main components: 

o  smbd itself creating the "/dev/smb/<n>" (or, in your generalisation,
   the named-pipe).

   Andrew Bartlett was against this detail and suggested instead using PAM
   and/or a proposed "session exec".  That's fine with me, for my
   "/dev/smb/<n>" case.

   Gerry (Jacobs):  Could you think about whether your model could use
   such a  mechanism?  That is, not done directly by smbd, but rather by
   an external agency, driven by smbd (PAM, "session exec"). 


o  Adjusting the main "event" loop of smbd to manage data on the pipe.

   This is where Jeremy entered, pointing out that the event loop has many
   subtleties, and tinkering with it is error-prone.  He suggested that
   (as some future point!) the event loop should be rewritten to allow
   other things (such as our named-pipe) to be plugged in.


o  The code to translate UNIX writes onto the named-pipe into WinPopup
   messages.  Gerry Jacobs proposes a "NamedPipe" API: my WinPopup code
   could then be a user of that API.


With care, we could here be laying the foundations for substantial
increased functionality and flexibility in future versions of samba. 

o  event loop able to have "pluggable" items: Jeremy Allison

o  hooks (PAM, "session-exec") for named-pipe creation/deletion: Andrew B.

o  "NamedPipe" API: Gerry Jacobs.


Hope that helps.

-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :




More information about the samba-technical mailing list