Skip to content

u_secdom.c error: too few arguments to function 'int getspnam_r()' #56

Open
@Leyrer-PNP

Description

After fixing issue #53, the compiler throws the following error:

u_secdom.c:73:15: error: too few arguments to function 'int getspnam_r(const char*, spwd*, char*, size_t, spwd**)'
   73 | if (getspnam_r(userName, &result, buffer, sizeof(buffer)))
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

getspnam_r(3) defines getspnam_r() as follows:

int getspnam_r(const char *name, struct spwd *spbuf,
        char *buf, size_t buflen, struct spwd **spbufp);

glibc has reentrant functions for the shadow password database. The getspnam_r() function is like getspnam() but stores the retrieved shadow password structure in the space pointed to by spbuf. This shadow password structure contains pointers to strings, and these strings are stored in the buffer buf of size buflen. A pointer to the result (in case of success) or NULL (in case no entry was found or an error occurred) is stored in *spbufp.

This difference seems to stem from some non-glibc systems also having functions with these names, often with different prototypes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions