userdb_read.3 (2010 09)

u
userdb_read(3) userdb_read(3)
USERDB_DISABLED
the database is disabled; see userdb (4)
USERDB_INVALID_USERNAME
the name
argument is not a valid username
USERDB_NOT_LOCAL_USER
the username specified by the
name argument is not a local user
in
/etc/passwd
EXAMPLES
The following program segment writes values for two attributes into the user database for user
joe, and
then deletes a third attribute. It then reads and prints two attributes plus the attribute which it
removed. Finally, it removes all of the attributes for user
amy.
#include <hpsecurity.h>
char p1[USERDB_MAX_ATTR_SIZE];
char p2[USERDB_MAX_ATTR_SIZE];
char p3[USERDB_MAX_ATTR_SIZE];
char *write_attrs[] = {
"AUDIT_FLAG", "MIN_PASSWORD_LENGTH", "AUTH_MAXTRIES", 0 };
char *write_values[] = { "1", "7", "", 0 };
char *read_attrs[] = {
"MIN_PASSWORD_LENGTH", "AUTH_MAXTRIES", "AUDIT_FLAG", 0 };
char *read_values[] = { p1, p2, p3, 0 };
if (userdb_write("joe", write_attrs, write_values))
exit(1);
if (userdb_read("joe", read_attrs, read_values))
exit(2);
printf ("p1=%s p2=%s p3=%s", p1, p2, p3);
userdb_delete("amy");
After successful execution, the output is:
p1=7 p2= p3=1
FILES
/var/adm/userdb user database
/etc/default/security
security defaults configuration file
/etc/security.dsc
security attributes description file
SEE ALSO
userdbget(1M), userdbset(1M), secdef(3), security(4), userdb(4).
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010