Changeset 133 for trunk/src/sh_unix.c
- Timestamp:
- Oct 25, 2007, 12:19:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r132 r133 883 883 { 884 884 char message[512]; 885 char hashbuf[KEYBUF_SIZE]; 885 886 886 887 SL_ENTER(_("sh_unix_self_hash")); … … 894 895 895 896 sl_strlcpy(sh.exec.hash, 896 sh_tiger_hash (c, TIGER_FILE, 0 ),897 sh_tiger_hash (c, TIGER_FILE, 0, hashbuf, sizeof(hashbuf)), 897 898 KEY_LEN+1); 898 899 sl_snprintf(message, 512, _("%s has checksum: %s"), … … 917 918 char newhash[KEY_LEN+1]; 918 919 char message[512]; 920 char hashbuf[KEYBUF_SIZE]; 919 921 920 922 SL_ENTER(_("sh_unix_self_check")); … … 922 924 SL_RETURN((0), _("sh_unix_self_check")); 923 925 924 sl_strlcpy(newhash, sh_tiger_hash (sh.exec.path, TIGER_FILE, 0), KEY_LEN+1); 926 sl_strlcpy(newhash, 927 sh_tiger_hash (sh.exec.path, TIGER_FILE, 0, hashbuf, sizeof(hashbuf)), 928 KEY_LEN+1); 925 929 if (0 == sl_strncmp(sh.exec.hash, 926 930 newhash, … … 2357 2361 } 2358 2362 2359 SH_MUTEX_STATIC( getUIDname, PTHREAD_MUTEX_INITIALIZER);2363 SH_MUTEX_STATIC(mutex_getUIDname, PTHREAD_MUTEX_INITIALIZER); 2360 2364 2361 2365 char * sh_unix_getUIDname (int level, uid_t uid, char * out, size_t len) … … 2375 2379 if ((uid == old_uid) && (name[0] != '\0')) { 2376 2380 out[0] = '\0'; 2377 SH_MUTEX_LOCK_UNSAFE( getUIDname);2381 SH_MUTEX_LOCK_UNSAFE(mutex_getUIDname); 2378 2382 if ((uid == old_uid) && (name[0] != '\0')) { 2379 2383 sl_strlcpy(out, name, len); 2380 2384 } 2381 SH_MUTEX_UNLOCK_UNSAFE( getUIDname);2385 SH_MUTEX_UNLOCK_UNSAFE(mutex_getUIDname); 2382 2386 if (out[0] != '\0') 2383 2387 SL_RETURN( out, _("sh_unix_getUIDname")); … … 2401 2405 2402 2406 if (tempres->pw_name != NULL) { 2403 SH_MUTEX_LOCK_UNSAFE( getUIDname);2407 SH_MUTEX_LOCK_UNSAFE(mutex_getUIDname); 2404 2408 sl_strlcpy(name, tempres->pw_name, sizeof(name)); 2405 2409 old_uid = uid; 2406 2410 sl_strlcpy(out, name, len); 2407 SH_MUTEX_UNLOCK_UNSAFE( getUIDname);2411 SH_MUTEX_UNLOCK_UNSAFE(mutex_getUIDname); 2408 2412 SL_RETURN( out, _("sh_unix_getUIDname")); 2409 2413 } else { … … 2415 2419 } 2416 2420 2417 SH_MUTEX_STATIC( getGIDname, PTHREAD_MUTEX_INITIALIZER);2421 SH_MUTEX_STATIC(mutex_getGIDname, PTHREAD_MUTEX_INITIALIZER); 2418 2422 2419 2423 char * sh_unix_getGIDname (int level, gid_t gid, char * out, size_t len) … … 2434 2438 if ((gid == old_gid) && (name[0] != '\0')) { 2435 2439 out[0] = '\0'; 2436 SH_MUTEX_LOCK_UNSAFE( getGIDname);2440 SH_MUTEX_LOCK_UNSAFE(mutex_getGIDname); 2437 2441 if ((gid == old_gid) && (name[0] != '\0')) { 2438 2442 sl_strlcpy(out, name, len); 2439 2443 } 2440 SH_MUTEX_UNLOCK_UNSAFE( getGIDname);2444 SH_MUTEX_UNLOCK_UNSAFE(mutex_getGIDname); 2441 2445 if (out[0] != '\0') 2442 2446 SL_RETURN( out, _("sh_unix_getGIDname")); … … 2459 2463 } 2460 2464 2461 /* FIXME: need to return caller-supplied buffer */2462 2465 if (tempres->gr_name != NULL) { 2463 SH_MUTEX_LOCK_UNSAFE( getGIDname);2466 SH_MUTEX_LOCK_UNSAFE(mutex_getGIDname); 2464 2467 sl_strlcpy(name, tempres->gr_name, sizeof(name)); 2465 2468 old_gid = gid; 2466 2469 sl_strlcpy(out, name, len); 2467 SH_MUTEX_UNLOCK_UNSAFE( getGIDname);2470 SH_MUTEX_UNLOCK_UNSAFE(mutex_getGIDname); 2468 2471 SL_RETURN( out, _("sh_unix_getGIDname")); 2469 2472 } else { … … 2993 2996 2994 2997 int sh_unix_checksum_size (char * filename, struct stat * fbuf, 2995 char * fileHash, int alert_timeout )2998 char * fileHash, int alert_timeout, SL_TICKET fd) 2996 2999 { 2997 3000 file_type tmpFile; … … 3016 3019 if (tmpFile.size < fbuf->st_size) 3017 3020 { 3021 char hashbuf[KEYBUF_SIZE]; 3018 3022 sl_strlcpy(fileHash, 3019 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size,3020 alert_timeout ),3023 sh_tiger_generic_hash (filename, fd, tmpFile.size, 3024 alert_timeout, hashbuf, sizeof(hashbuf)), 3021 3025 KEY_LEN+1); 3022 3026 … … 3355 3359 else 3356 3360 { 3357 tiger_fd = rval_open;3361 char hashbuf[KEYBUF_SIZE]; 3358 3362 sl_strlcpy(fileHash, 3359 3363 sh_tiger_generic_hash (theFile->fullpath, 3360 TIGER_FD, TIGER_NOLIM, 3361 alert_timeout), 3364 rval_open, TIGER_NOLIM, 3365 alert_timeout, 3366 hashbuf, sizeof(hashbuf)), 3362 3367 KEY_LEN+1); 3363 3368 if ((theFile->check_mask & MODI_SGROW) != 0) 3364 3369 { 3365 3370 sl_rewind(rval_open); 3366 tiger_fd = rval_open;3367 3371 sh_unix_checksum_size (theFile->fullpath, &fbuf, 3368 3372 &fileHash[KEY_LEN + 1], 3369 alert_timeout );3373 alert_timeout, rval_open); 3370 3374 } 3371 3375 } … … 3395 3399 else 3396 3400 { 3397 tiger_fd = rval_open;3401 char hashbuf[KEYBUF_SIZE]; 3398 3402 sl_strlcpy(fileHash, 3399 sh_tiger_generic_hash (theFile->fullpath, TIGER_FD, TIGER_NOLIM, 3400 alert_timeout), 3403 sh_tiger_generic_hash (theFile->fullpath, rval_open, 3404 TIGER_NOLIM, 3405 alert_timeout, 3406 hashbuf, sizeof(hashbuf)), 3401 3407 KEY_LEN + 1); 3402 3408 if ((theFile->check_mask & MODI_SGROW) != 0) 3403 3409 { 3404 3410 sl_rewind(rval_open); 3405 tiger_fd = rval_open;3406 3411 sh_unix_checksum_size (theFile->fullpath, &fbuf, 3407 3412 &fileHash[KEY_LEN + 1], 3408 alert_timeout );3413 alert_timeout, rval_open); 3409 3414 } 3410 3415 }
Note:
See TracChangeset
for help on using the changeset viewer.