#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header$");
+RCSID
+ ("$Header$");
-#include "uss_ptserver.h" /*Module interface*/
-#include <afs/ptclient.h> /*Protection Server client interface*/
-#include <afs/pterror.h> /*Protection Server error codes*/
-#include <afs/com_err.h> /*Error code xlation*/
+#include "uss_ptserver.h" /*Module interface */
+#include <afs/ptclient.h> /*Protection Server client interface */
+#include <afs/pterror.h> /*Protection Server error codes */
+#include <afs/com_err.h> /*Error code xlation */
#undef USS_PTSERVER_DB
/*
* ------------------------ Private globals -----------------------
*/
-static int initDone = 0; /*Module initialized?*/
+static int initDone = 0; /*Module initialized? */
/*-----------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-static afs_int32 InitThisModule()
+static afs_int32
+InitThisModule()
+{ /*InitThisModule */
-{ /*InitThisModule*/
-
- static char rn[] =
- "uss_ptserver:InitThisModule"; /*Routine name*/
- register afs_int32 code; /*Return code*/
+ static char rn[] = "uss_ptserver:InitThisModule"; /*Routine name */
+ register afs_int32 code; /*Return code */
/*
* Only once, guys.
*/
if (initDone)
- return(0);
+ return (0);
/*
* Connect up with the Protection Server.
*/
#ifdef USS_PTSERVER_DB
- printf("%s: Initializing Protection Server: security=1, confdir = '%s', cell = '%s'\n",
- rn, uss_ConfDir, uss_Cell);
+ printf
+ ("%s: Initializing Protection Server: security=1, confdir = '%s', cell = '%s'\n",
+ rn, uss_ConfDir, uss_Cell);
#endif /* USS_PTSERVER_DB */
- code = pr_Initialize(1, /*Security level*/
- uss_ConfDir, /*Config directory*/
- uss_Cell); /*Cell to touch*/
+ code = pr_Initialize(1, /*Security level */
+ uss_ConfDir, /*Config directory */
+ uss_Cell); /*Cell to touch */
if (code) {
com_err(uss_whoami, code,
"while initializing Protection Server library");
- return(code);
+ return (code);
}
initDone = 1;
- return(0);
+ return (0);
-} /*InitThisModule*/
+} /*InitThisModule */
/*-----------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-afs_int32 uss_ptserver_AddUser(a_user, a_uid)
- char *a_user;
- char *a_uid;
+afs_int32
+uss_ptserver_AddUser(a_user, a_uid)
+ char *a_user;
+ char *a_uid;
+
+{ /*uss_ptserver_AddUser */
-{ /*uss_ptserver_AddUser*/
+ afs_int32 code; /*Various return codes */
+ afs_int32 id = uss_DesiredUID; /*ID desired for user, if any */
+ afs_int32 mappedUserID; /*ID user already has */
- afs_int32 code; /*Various return codes*/
- afs_int32 id = uss_DesiredUID; /*ID desired for user, if any*/
- afs_int32 mappedUserID; /*ID user already has*/
-
if (uss_verbose) {
- fprintf(stderr, "Adding user '%s' to the Protection DB\n",
- a_user);
+ fprintf(stderr, "Adding user '%s' to the Protection DB\n", a_user);
if (id)
fprintf(stderr, "\t[Presetting uid to %d]\n", id);
}
-
+
/*
* Make sure we're initialized before doing anything.
*/
if (!initDone) {
code = InitThisModule();
if (code)
- return(code);
+ return (code);
}
-
+
/*
* If this is a dry run, we still need to setup the uid before
* returning.
*/
if (uss_DryRun) {
- fprintf(stderr, "\t[Dry run - user %d not created]\n", uss_DesiredUID);
+ fprintf(stderr, "\t[Dry run - user %d not created]\n",
+ uss_DesiredUID);
sprintf(a_uid, "%d", uss_DesiredUID);
- return(0);
+ return (0);
}
/*
*/
code = pr_CreateUser(a_user, &id);
if (code) {
- if (code == PREXIST || code == PRIDEXIST) {
+ if (code == PREXIST || code == PRIDEXIST) {
if (code == PREXIST)
fprintf(stderr,
"%s: Warning: '%s' already in the Protection DB\n",
if (code = pr_SNameToId(a_user, &mappedUserID)) {
com_err(uss_whoami, code,
"while getting uid from Protection Server");
- return(code);
+ return (code);
}
if (mappedUserID == ANONYMOUSID) {
fprintf(stderr,
"%s: User '%s' unknown, yet given id (%d) already has a mapping!\n",
uss_whoami, a_user, id);
- return(PRIDEXIST);
+ return (PRIDEXIST);
}
if (id == 0)
id = mappedUserID;
- else
- if (mappedUserID != id) {
- fprintf(stderr,
- "%s: User '%s' already has id %d; won't assign id %d\n",
- uss_whoami, a_user, mappedUserID, id);
- return(PRIDEXIST);
- }
- }
- else {
+ else if (mappedUserID != id) {
+ fprintf(stderr,
+ "%s: User '%s' already has id %d; won't assign id %d\n",
+ uss_whoami, a_user, mappedUserID, id);
+ return (PRIDEXIST);
+ }
+ } else {
/*
* Got a fatal error.
*/
com_err(uss_whoami, code, "while accessing Protection Server");
- return(code);
+ return (code);
}
- } /*Create the user's protection entry*/
-
+ }
+ /*Create the user's protection entry */
sprintf(a_uid, "%d", id);
if (uss_verbose)
fprintf(stderr, "The uid for user '%s' is %s\n", a_user, a_uid);
-
+
/*
* Return sweetness & light.
*/
- return(0);
+ return (0);
-} /*uss_ptserver_AddUser*/
+} /*uss_ptserver_AddUser */
/*-----------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-afs_int32 uss_ptserver_DelUser(a_name)
- char *a_name;
+afs_int32
+uss_ptserver_DelUser(a_name)
+ char *a_name;
-{ /*uss_ptserver_DelUser*/
+{ /*uss_ptserver_DelUser */
+
+ afs_int32 code; /*Various return codes */
- afs_int32 code; /*Various return codes*/
-
/*
* Make sure we're initialized before doing anything.
*/
if (!initDone) {
code = InitThisModule();
if (code)
- return(code);
+ return (code);
}
if (uss_DryRun) {
fprintf(stderr,
"\t[Dry run - user '%s' not deleted from Protection DB]\n",
a_name);
- return(0);
+ return (0);
}
if (uss_verbose)
*/
code = pr_Delete(a_name);
if (code) {
- if (code == PRNOENT) {
+ if (code == PRNOENT) {
/*
* There's no entry for that user in the Protection DB,
* so our job is done.
fprintf(stderr,
"%s: Warning: User '%s' not found in Protection DB\n",
uss_whoami, a_name);
- } /*User not registered*/
+ } /*User not registered */
else {
com_err(uss_whoami, code,
"while deleting user from Protection DB");
- return(code);
- } /*Fatal PTS error*/
- } /*Error in deletion*/
-
+ return (code);
+ } /*Fatal PTS error */
+ }
+
+ /*Error in deletion */
/*
* Return sweetness & light.
*/
- return(0);
+ return (0);
-} /*uss_ptserver_DelUser*/
+} /*uss_ptserver_DelUser */
/*-----------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-afs_int32 uss_ptserver_XlateUser(a_user, a_uidP)
- char *a_user;
- afs_int32 *a_uidP;
+afs_int32
+uss_ptserver_XlateUser(a_user, a_uidP)
+ char *a_user;
+ afs_int32 *a_uidP;
-{ /*uss_ptserver_XlateUser*/
+{ /*uss_ptserver_XlateUser */
- static char rn[] = "uss_ptserver_XlateUser"; /*Routine name*/
- register afs_int32 code; /*Various return codes*/
+ static char rn[] = "uss_ptserver_XlateUser"; /*Routine name */
+ register afs_int32 code; /*Various return codes */
if (uss_verbose)
fprintf(stderr, "Translating user '%s' via the Protection DB\n",
if (!initDone) {
code = InitThisModule();
if (code)
- return(code);
+ return (code);
}
/*
code = pr_SNameToId(a_user, a_uidP);
if (code) {
com_err(uss_whoami, code, "while getting uid from Protection DB");
- return(code);
+ return (code);
}
if (*a_uidP == ANONYMOUSID) {
- fprintf(stderr,
- "%s: No entry for user '%s' in the Protection DB\n",
+ fprintf(stderr, "%s: No entry for user '%s' in the Protection DB\n",
uss_whoami, a_user);
- return(code);
+ return (code);
}
/*
#ifdef USS_PTSERVER_DB
printf("%s: User '%s' maps to uid %d\n", rn, a_user, *a_uidP);
#endif /* USS_PTSERVER_DB */
- return(0);
+ return (0);
-} /*uss_ptserver_XlateUser*/
+} /*uss_ptserver_XlateUser */