Home share sub-folder's

Eddy PELAIC eddy.pelaic at univ-paris5.fr
Mon Sep 10 14:28:00 GMT 2007


excuse me for my english ;-)

I had a problem with smb.conf subtitution variables because I use 
subfolder's in the home share of the user (easier to find home when you 
have 5000 user in the same home share).

ex: for user 'toto' in share HOME, the path will be   // HOME / t / o / toto

but samba don't have regexp

so I put in samba sources/lib/substitute.c some modifications.

ligne 34 add:

static fstring smb_user_name_dir;

in function void sub_set_smb_name(const char *name)

add at ligne 139 after alpha_strcpy( smb_user_name.... )

    smb_user_name_dir[0] = smb_user_name[0];
    smb_user_name_dir[1] = '/';
    smb_user_name_dir[2] = smb_user_name[1];
    smb_user_name_dir[3] = '\0';

in function char *alloc_sub_basic(const char *smb_name, const char 
                      const char *str)

add in switch (*(p+1)))

    case 'x' :
                        r = strdup_lower(smb_user_name_dir);
                        if (r == NULL) {
                                goto error;
                        a_string = realloc_string_sub(a_string, "%x", r);

in this case the %x substitute variable give for user toto the string 
't/o' that can be usefull sometimes in smb.conf



Service informatique
Faculté de chirurgie dentaire 
Université Paris Descartes
1, rue Maurice Arnoux

Tel: 01 58 07 67 13
mail: eddy.pelaic at univ-paris5.fr 

More information about the samba-technical mailing list