Proposal: filename map

Kevin Currie kevin.currie at wmich.edu
Fri Jun 12 16:56:21 GMT 1998


>first things first: would you like to have a go at abstracting the "map
>username" code?

>we need to use it [the code that currently only reads the "map username"
>option] in other places, and your suggestion is one of them.


    Okay after looking at the "map username" code (the part that reads the
file anyway), here is how I interpret what you are talking about.
    we have a function something like:

    char * file_mapping(char * mapfilename, char * variable);

    This fucntion will read mapfilename line by line.  It will change any
Samba % qualifiers into their equivilant values and both sides of the "="
then try and match variable to something on the right side of the "=" and if
it does, it will change variable to the match on the left side of the "=".
Thus,


// code sort of semi-example

char * user = "Administrator";
char * file = "/etc/smbusers";

// This is the old way

mapuser(user);

// this becomes, or something similar

user = file_mapping(file, user);



    Is this sort of what you had in mind?


Kevin



More information about the samba-technical mailing list