+/**
+ * This function is exported; glibc will invoke it in order to gather
+ * the user information (userid, homedir, shell) associated with a
+ * numerical userid.
+ */
+enum nss_status _nss_afs_getpwuid_r (uid_t uid,
+ struct passwd *result_buf,
+ char *buffer,
+ size_t buflen,
+ int *errnop) {
+ int temp;
+ char* name;
+
+ if (init_afs()) return NSS_STATUS_UNAVAIL;
+
+ name = buffer;
+ temp = ptsid2name( uid, &buffer, &buflen);
+ if (temp != NSS_STATUS_SUCCESS) {
+ *errnop = ENOENT;
+ return temp;
+ }
+
+#ifdef LIMIT_USERNAME_CHARS
+ if ( strlen(result_buf->pw_name) > LIMIT_USERNAME_CHARS ) {
+ result_buf->pw_name[LIMIT_USERNAME_CHARS] = '\0';
+ buflen = buflen + ( buffer - &result_buf->pw_name[LIMIT_USERNAME_CHARS+1] );
+ buffer = &result_buf->pw_name[LIMIT_USERNAME_CHARS+1];
+ }
+#endif
+
+ return fill_result_buf(uid, name, result_buf, buffer, buflen, errnop);
+}
+
+/**
+ * This function is exported; glibc will invoke it in order to gather
+ * the user information (userid, homedir, shell) associated with a
+ * username.