void *cellHandle;
void *tokenHandle;
+int existing_tokens = 0;
#ifdef AFS_DARWIN_ENV
pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER;
if (as->parms[AUTHCELL_PARAM].items) {
ERR_EXT("you can't specify both -noauth and -authcell");
}
+ if (as->parms[USEEXISTTOKENS_PARAM].items) {
+ ERR_EXT("you can't specify both -noauth and -usetokens");
+ }
+ }
+
+ /*
+ * Check for usetokens
+ */
+
+ if (as->parms[USEEXISTTOKENS_PARAM].items) {
+ existing_tokens = 1;
+ if (as->parms[USER_PARAM].items) {
+ ERR_EXT("you can't specify both -usetokens and -authuser");
+ }
+ if (as->parms[PASSWORD_PARAM].items) {
+ ERR_EXT("you can't specify both -usetokens and -authpassword");
+ }
}
/*
&st)) {
ERR_ST_EXT("can't get noauth tokens", st);
}
+ } else if (existing_tokens) {
+ if (as->parms[AUTHCELL_PARAM].items) {
+ /* Look for existing tokens for this cell */
+ strcpy(auth_cell, as->parms[AUTHCELL_PARAM].items->data);
+ } else {
+ if (!afsclient_LocalCellGet(auth_cell, &st)) {
+ ERR_ST_EXT("can't get local cell name", st);
+ }
+ }
+ if (!afsclient_TokenGetExisting((const char*)auth_cell, &tokenHandle, &st)) {
+ ERR_ST_EXT("can't find existing tokens", st);
+ }
} else {
if (!afsclient_TokenGetNew
(auth_cell, (const char *)as->parms[USER_PARAM].items->data,
"cell where command will execute");
cmd_AddParm(as, "-noauth", CMD_FLAG, CMD_OPTIONAL,
"run this command unauthenticated");
+ cmd_AddParm(as, "-usetokens", CMD_FLAG, CMD_OPTIONAL,
+ "use already existing tokens");
}
int
kas_identity_t user;
const char *password;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
afs_status_t st = 0;
kas_identity_t user;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
kas_identity_t user;
kas_principalEntry_t principal;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
void *iter;
kas_identity_t prin;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
if (!kas_PrincipalGetBegin(cellHandle, 0, &iter, &st)) {
ERR_ST_EXT("kas_PrincipalGetBegin", st);
}
const char *cell;
const char *password;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
kas_identity_t user;
unsigned int lock_end_time = 0;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
afs_status_t st = 0;
kas_identity_t user;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
unsigned int *failed_password_lock_time_ptr = NULL;
int have_failed_password_lock_time = 0;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
strcpy(user.principal, as->parms[PRINCIPAL].items->data);
if (as->parms[INSTANCE].items) {
void *kas_server = NULL;
kas_serverStats_t stats;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
if (as->parms[SERVER].items) {
server_list[0] = as->parms[SERVER].items->data;
}
void *kas_server = NULL;
kas_serverDebugInfo_t debug;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
if (as->parms[SERVER].items) {
server_list[0] = as->parms[SERVER].items->data;
}
kas_encryptionKey_t key;
int i;
+ if (existing_tokens) {
+ ERR_EXT("can't use -usetokens with kas functions");
+ }
+
if (!kas_ServerRandomKeyGet(cellHandle, 0, &key, &st)) {
ERR_ST_EXT("kas_ServerRandomKeyGet", st);
}