Bug 5198 - Gecos field is passed as full name

Jesse Malone jmalone at jsoft.ca
Fri Feb 5 15:32:51 MST 2010


Once more (and this time it better start a new thread), I, and others,
have noticed that the gecos field is not parsed by samba, and so we
wind up with the entire comma seperated gecos field as a user's full name.

The bug is posted here: https://bugzilla.samba.org/show_bug.cgi?id=5198

It doesn't look like there has been any activity or comment on this bug
from any
knowledgeable developers. I've proposed  a potential solution, but don't
really know
samba at all and would appreciate comments from those more knowledgeable
than me.

My proposal follows: I'll start off by saying I really don't know this
project so
opinions/corrections/suggestions are very much appreciated. Proposed fix
thus far):

For samba 3.4.3 in passdb/pdb_get_set.c, at line 36

const char *pdb_fullname_from_gecos(const char* gecos) {
        // the sampass->fullname field doesn't separate
        // fullname from the other gecos fields. This
        // will grab just the name
         size_t len;
         char* fullname;
         len = strcspn(gecos,",");
         fullname = malloc((len+1)*sizeof(char));
         fullname[len] = '\0'; //ensure null termination
         return fullname;
const char *pdb_get_fullname(const struct samu *sampass) {
        return pdb_fullname_from_gecos(sampass->full_name);


Jesse Malone
WebCanada Inc.
jesse.malone at webcanada.com

More information about the samba-technical mailing list