code triplication

Urban Widmark urban at teststation.com
Sat Oct 13 05:26:01 GMT 2001


On Sat, 13 Oct 2001, andreas moroder wrote:

> In clinet/smbmount.c 	read_credential_file
> in rpcclient/rpcclient.c        read_authfile
> in client/client.c		in main the case 'A'

Yes, I thought having it in the case was ugly so I moved it to a function
for smbmount. Didn't look at rpcclient.c.


> Is there a reason for this triplications ? Would it not be better to have one 
> common function ?

There is no particular reason for that, other than that it is easier to
copy and change someone elses solution than to write one that both can be
happy with (when there are different maintainers).

Also, there is no set "pattern" for sharing things between smbmount and
smbclient, other than libsmb (and these things do not belong in libsmb, at
least not as I see it).

If you compare client/smbmount.c and client/client.c you should be able to
spot a few other similarities (eg do_connection vs do_connect).


The smbmount.c read_credential_file has bugs in what characters it allows.
If someone (you?) wants to clean this up, that should probably also be
fixed at the same time.

One way is to move certain helper functions into something like
"client/common.c" if these can not be seen as library routines. But it is
for the samba team to decide where things should go.


When I get around to fixing the smbmount read_credential_file bugs I may
have a look at this, but if someone beats me to it ...

For smbmount, read_credential_file should perhaps be read_option_file, and
that file could list any of the options smbmount accepts. That would make
it more different from smbclient (perhaps some common syntax could be
agreed on, with the different clients translating to their internal
needs).

/Urban





More information about the samba-technical mailing list