Returns the value of the specified single-valued attribute for the specified object.
#include <ascauth.h>
int ASC_READATTR(ASCENV *asce, char *object, char *attribute, char *buffer, u_int bufsize);
Returns one of the following integer values defined in ascauth.h:
The results are truncated, and the call returns AS_TOOSMALL if the buffer size cannot hold the entire attribute value. You can retry with a larger buffer.
Only the Home Directory attribute of a User object is supported at this time.
#include <stdio.h> #include <stdlib.h> #include <ascauth.h> main(int argc, char *argv[]) { ASCENV *asce; char *user, buffer[2000]; int rc; if (argc != 2) { fprintf(stderr, "usage: %s <UserObjectFDN>\n", argv[0]); exit(EXIT_FAILURE); } user = argv[1]; /* initialize the authentication environment */ asce = ASC_INIT(NULL); if (asce == NULL) { fprintf(stderr, "Error: cannot initialize authentication environment\n"); exit(EXIT_FAILURE); } /* Get User object's home directory info */ rc = ASC_READATTR(asce, user, "HOME DIRECTORY", buffer, sizeof(buffer)); if (rc == AS_OK) printf("Home Directory for User object %s:\n%s\n", user, buffer); else printf("RC=%d, %s", rc, ASC_STRERROR(rc)); /* now terminate the authentication environment */ ASC_TERM(asce); return 0; }