Changeset 8358
- Timestamp:
- 06/04/10 15:26:25 (3 years ago)
- Location:
- branches/cu-security-branch
- Files:
-
- 6 modified
-
include/pvfs2-util.h (modified) (1 diff)
-
src/apps/admin/pvfs2-cp.c (modified) (3 diffs)
-
src/apps/admin/pvfs2-fs-dump.c (modified) (8 diffs)
-
src/apps/admin/pvfs2-fsck.c (modified) (10 diffs)
-
src/apps/admin/pvfs2-perf-mon-example.c (modified) (2 diffs)
-
src/common/misc/pvfs2-util.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/cu-security-branch/include/pvfs2-util.h
r8354 r8358 47 47 int PVFS_util_gen_credential(const char *user, unsigned int timeout, 48 48 const char *keypath, PVFS_credential *cred); 49 int PVFS_util_refresh_credential(PVFS_credential *cred); 49 50 50 51 int PVFS_util_copy_sys_attr( -
branches/cu-security-branch/src/apps/admin/pvfs2-cp.c
r8354 r8358 149 149 resolve_filename(&dest, user_opts->destfile); 150 150 151 /* nlmills: TODO: find a better way to handle timeouts */ 152 ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &credentials); 151 ret = PVFS_util_gen_credential_defaults(&credentials); 153 152 if (ret < 0) 154 153 { … … 344 343 return (ret); 345 344 } 345 PVFS_util_refresh_credential(credentials); 346 346 ret = PVFS_sys_read(src->u.pvfs2.ref, file_req, offset, 347 347 buffer, mem_req, credentials, &resp_io, hints); … … 376 376 return(ret); 377 377 } 378 PVFS_util_refresh_credential(credentials); 378 379 ret = PVFS_sys_write(dest->u.pvfs2.ref, file_req, offset, 379 380 buffer, mem_req, credentials, &resp_io, hints); -
branches/cu-security-branch/src/apps/admin/pvfs2-fs-dump.c
r8351 r8358 139 139 } 140 140 141 /* nlmills: TODO: find a better way to handle credential timeouts */ 142 ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &creds); 141 ret = PVFS_util_gen_credential_defaults(&creds); 143 142 if (ret < 0) 144 143 { 145 PVFS_perror("PVFS_util_gen_credential ", ret);144 PVFS_perror("PVFS_util_gen_credential_defaults", ret); 146 145 return(-1); 147 146 } … … 256 255 struct PVFS_mgmt_server_stat *stat_array; 257 256 struct PVFS_mgmt_setparam_value param_value; 257 258 PVFS_util_refresh_credential(creds); 258 259 259 260 /* find out how many handles are in use on each */ … … 359 360 do 360 361 { 361 ret = PVFS_mgmt_iterate_handles_list(cur_fs, 362 PVFS_util_refresh_credential(creds); 363 ret = PVFS_mgmt_iterate_handles_list(cur_fs, 362 364 creds, 363 365 handle_matrix, … … 454 456 PVFS_object_ref pref; 455 457 458 PVFS_util_refresh_credential(creds); 459 456 460 PVFS_sys_lookup(cur_fs, "/", creds, 457 461 &lookup_resp, PVFS2_LOOKUP_LINK_NO_FOLLOW, NULL); … … 506 510 token = 0; 507 511 do { 512 PVFS_util_refresh_credential(creds); 513 508 514 memset(&readdir_resp, 0, sizeof(PVFS_sysresp_readdir)); 509 515 ret = PVFS_sys_readdir(pref, … … 518 524 char *cur_file; 519 525 PVFS_handle cur_handle; 526 527 PVFS_util_refresh_credential(creds); 520 528 521 529 cur_handle = readdir_resp.dirent_array[i].handle; … … 600 608 PVFS_handle *df_handles; 601 609 610 PVFS_util_refresh_credential(creds); 611 602 612 df_handles = (PVFS_handle *) malloc(df_count * sizeof(PVFS_handle)); 603 613 if (df_handles == NULL) … … 654 664 PVFS_object_ref entry_ref; 655 665 char* fmt_string; 666 667 PVFS_util_refresh_credential(creds); 656 668 657 669 entry_ref.handle = handle; -
branches/cu-security-branch/src/apps/admin/pvfs2-fsck.c
r8351 r8358 82 82 } 83 83 84 /* nlmills: TODO: find a better way to handle credential timeouts */ 85 ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &creds); 84 ret = PVFS_util_gen_credential_defaults(&creds); 86 85 if (ret < 0) 87 86 { 88 PVFS_perror("PVFS_util_gen_credential ", ret);87 PVFS_perror("PVFS_util_gen_credential_defaults", ret); 89 88 return -1; 90 89 } … … 189 188 handlelist_finalize(&hl_all); 190 189 190 PVFS_util_refresh_credential(&creds); 191 191 192 param_value.type = PVFS_MGMT_PARAM_TYPE_UINT64; 192 193 param_value.u.value = PVFS_SERVER_NORMAL_MODE; … … 225 226 226 227 exit_now: 228 PVFS_util_refresh_credential(&creds); 229 227 230 if (in_admin_mode) { 228 231 … … 264 267 struct PVFS_mgmt_setparam_value param_value; 265 268 269 PVFS_util_refresh_credential(creds); 270 266 271 /* find out how many handles are in use on each */ 267 272 stat_array = (struct PVFS_mgmt_server_stat *) … … 368 373 while (more_flag) 369 374 { 375 PVFS_util_refresh_credential(creds); 376 370 377 ret = PVFS_mgmt_iterate_handles_list(cur_fs, 371 378 creds, … … 452 459 while (more_flag) 453 460 { 461 PVFS_util_refresh_credential(creds); 462 454 463 ret = PVFS_mgmt_iterate_handles_list(cur_fs, 455 464 creds, … … 534 543 PVFS_sysresp_getattr getattr_resp; 535 544 PVFS_object_ref pref; 545 546 PVFS_util_refresh_credential(creds); 536 547 537 548 ret = PVFS_sys_lookup(cur_fs, … … 889 900 PVFS_sysresp_getattr getattr_resp; 890 901 902 PVFS_util_refresh_credential(creds); 903 891 904 handle_ref.handle = handle; 892 905 handle_ref.fs_id = cur_fs; … … 969 982 PVFS_object_ref handle_ref; 970 983 PVFS_sysresp_getattr getattr_resp; 984 985 PVFS_util_refresh_credential(creds); 971 986 972 987 handle_ref.handle = handle; … … 1080 1095 PVFS_object_ref handle_ref; 1081 1096 PVFS_sysresp_getattr getattr_resp; 1097 1098 PVFS_util_refresh_credential(creds); 1082 1099 1083 1100 handle_ref.handle = handle; -
branches/cu-security-branch/src/apps/admin/pvfs2-perf-mon-example.c
r8351 r8358 79 79 } 80 80 81 /* nlmills: TODO: find a better way to handle credential timeouts */82 81 ret = PVFS_util_gen_credential(NULL, 1*60*60, NULL, &creds); 83 82 if (ret < 0) … … 155 154 while (1) 156 155 { 156 PVFS_util_refresh_credential(&creds); 157 157 ret = PVFS_mgmt_perf_mon_list(cur_fs, 158 158 &creds, -
branches/cu-security-branch/src/common/misc/pvfs2-util.c
r8354 r8358 269 269 close(filedes[0]); 270 270 sigaction(SIGCLD, &oldsa, NULL); 271 272 return ret; 273 } 274 275 int PVFS_util_refresh_credential(PVFS_credential *cred) 276 { 277 int ret; 278 279 /* =if the credential is valid for at least a minute */ 280 if (PINT_util_get_current_time() <= cred->timeout - 60) 281 { 282 ret = 0; 283 } 284 else 285 { 286 PINT_cleanup_credential(cred); 287 ret = PVFS_util_gen_credential_defaults(cred); 288 } 271 289 272 290 return ret;
