|
Lines 10-22
Link Here
|
| 10 |
*/ |
10 |
*/ |
| 11 |
|
11 |
|
| 12 |
|
12 |
|
|
|
13 |
#define _GNU_SOURCE |
| 13 |
#include <unistd.h> |
14 |
#include <unistd.h> |
| 14 |
#include <sys/types.h> |
15 |
#include <sys/types.h> |
| 15 |
#include <sys/statfs.h> |
|
|
| 16 |
#include <sys/stat.h> |
16 |
#include <sys/stat.h> |
| 17 |
#include <stdio.h> |
17 |
#include <stdio.h> |
| 18 |
#include <fcntl.h> |
18 |
#include <fcntl.h> |
| 19 |
#include <errno.h> |
19 |
#include <errno.h> |
|
|
20 |
#include <dirent.h> |
| 20 |
|
21 |
|
| 21 |
#ifdef _SYS_STATFS_H |
22 |
#ifdef _SYS_STATFS_H |
| 22 |
#define _I386_STATFS_H /* two versions of statfs is not good ... */ |
23 |
#define _I386_STATFS_H /* two versions of statfs is not good ... */ |
|
Lines 73-79
Link Here
|
| 73 |
static char *getval_user; |
74 |
static char *getval_user; |
| 74 |
|
75 |
|
| 75 |
typedef struct Pass { |
76 |
typedef struct Pass { |
| 76 |
long crc[MAX_PW_CRC]; |
77 |
int crc[MAX_PW_CRC]; |
| 77 |
char *unique; |
78 |
char *unique; |
| 78 |
char *label; |
79 |
char *label; |
| 79 |
struct Pass *next; |
80 |
struct Pass *next; |
|
Lines 254-260
Link Here
|
| 254 |
|
256 |
|
| 255 |
for (walk=pwsave; walk; walk=walk->next) { |
257 |
for (walk=pwsave; walk; walk=walk->next) { |
| 256 |
fprintf(pw_file, "label=<\"%s\">", walk->label); |
258 |
fprintf(pw_file, "label=<\"%s\">", walk->label); |
| 257 |
for (i=0; i<MAX_PW_CRC; i++) fprintf(pw_file, " 0x%08lX", walk->crc[i]); |
259 |
for (i=0; i<MAX_PW_CRC; i++) fprintf(pw_file, " 0x%08X", walk->crc[i]); |
| 258 |
fprintf(pw_file, "\n"); |
260 |
fprintf(pw_file, "\n"); |
| 259 |
} |
261 |
} |
| 260 |
} |
262 |
} |
|
Lines 295-306
Link Here
|
| 295 |
if (verbose >=5) printf("end pw_fill_cache\n"); |
297 |
if (verbose >=5) printf("end pw_fill_cache\n"); |
| 296 |
} |
298 |
} |
| 297 |
|
299 |
|
| 298 |
static void hash_password(char *password, long crcval[]) |
300 |
static void hash_password(char *password, int crcval[]) |
| 299 |
{ |
301 |
{ |
| 300 |
#ifdef CRC_PASSWORDS |
302 |
#ifdef CRC_PASSWORDS |
| 301 |
static long poly[] = {CRC_POLY1, CRC_POLY2, CRC_POLY3, CRC_POLY4, CRC_POLY5}; |
303 |
static int poly[] = {CRC_POLY1, CRC_POLY2, CRC_POLY3, CRC_POLY4, CRC_POLY5}; |
| 302 |
#endif |
304 |
#endif |
| 303 |
long crc; |
305 |
int crc; |
| 304 |
int j; |
306 |
int j; |
| 305 |
int i = strlen(password); |
307 |
int i = strlen(password); |
| 306 |
|
308 |
|
|
Lines 320-326
Link Here
|
| 320 |
#endif |
322 |
#endif |
| 321 |
if(verbose >= 2) { |
323 |
if(verbose >= 2) { |
| 322 |
if (j==0) printf("Password " PWTYPE " ="); |
324 |
if (j==0) printf("Password " PWTYPE " ="); |
| 323 |
printf(" %08lX", crc); |
325 |
printf(" %08X", crc); |
| 324 |
} |
326 |
} |
| 325 |
} |
327 |
} |
| 326 |
if (verbose >= 2) printf("\n"); |
328 |
if (verbose >= 2) printf("\n"); |
|
Lines 364-370
Link Here
|
| 364 |
} |
366 |
} |
| 365 |
#endif |
367 |
#endif |
| 366 |
|
368 |
|
| 367 |
static void pw_get(char *pass, long crcval[], int option) |
369 |
static void pw_get(char *pass, int crcval[], int option) |
| 368 |
{ |
370 |
{ |
| 369 |
PASSWORD *walk; |
371 |
PASSWORD *walk; |
| 370 |
char *pass2; |
372 |
char *pass2; |
|
Lines 379-385
Link Here
|
| 379 |
for (walk=pwsave; walk; walk=walk->next) { |
381 |
for (walk=pwsave; walk; walk=walk->next) { |
| 380 |
if (pass == walk->unique || |
382 |
if (pass == walk->unique || |
| 381 |
(!walk->unique && !strcmp(walk->label,label) && (walk->unique=pass)) ) { |
383 |
(!walk->unique && !strcmp(walk->label,label) && (walk->unique=pass)) ) { |
| 382 |
memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(long)); |
384 |
memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(int)); |
| 383 |
return; |
385 |
return; |
| 384 |
} |
386 |
} |
| 385 |
} |
387 |
} |
|
Lines 407-417
Link Here
|
| 407 |
pw_wipe(pass2); |
409 |
pw_wipe(pass2); |
| 408 |
hash_password(pass, walk->crc); |
410 |
hash_password(pass, walk->crc); |
| 409 |
pw_wipe(pass); |
411 |
pw_wipe(pass); |
| 410 |
memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(long)); |
412 |
memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(int)); |
| 411 |
} |
413 |
} |
| 412 |
|
414 |
|
| 413 |
|
415 |
|
| 414 |
static void retrieve_crc(long crcval[]) |
416 |
static void retrieve_crc(int crcval[]) |
| 415 |
{ |
417 |
{ |
| 416 |
int i; |
418 |
int i; |
| 417 |
char *pass; |
419 |
char *pass; |
|
Lines 425-431
Link Here
|
| 425 |
|
427 |
|
| 426 |
if (verbose >= 1) { |
428 |
if (verbose >= 1) { |
| 427 |
printf("Password found is"); |
429 |
printf("Password found is"); |
| 428 |
for (i=0; i<MAX_PW_CRC; i++) printf(" %08lX", crcval[i]); |
430 |
for (i=0; i<MAX_PW_CRC; i++) printf(" %08X", crcval[i]); |
| 429 |
printf("\n"); |
431 |
printf("\n"); |
| 430 |
} |
432 |
} |
| 431 |
} |
433 |
} |
|
Lines 486-492
Link Here
|
| 486 |
/* order of color attributes is: |
488 |
/* order of color attributes is: |
| 487 |
text, hilighted text, border, title |
489 |
text, hilighted text, border, title |
| 488 |
*/ |
490 |
*/ |
| 489 |
#define color(c) ((int)strchr(khar,(int)(c))-(int)khar) |
491 |
#define color(c) ((int)(strchr(khar,(int)(c))-khar)) |
| 490 |
bg = 0; |
492 |
bg = 0; |
| 491 |
at = &(menu->at_text); |
493 |
at = &(menu->at_text); |
| 492 |
for (i=0; i<4 && *scheme; i++) { |
494 |
for (i=0; i<4 && *scheme; i++) { |
|
Lines 529-535
Link Here
|
| 529 |
|
531 |
|
| 530 |
|
532 |
|
| 531 |
void bsect_open(char *boot_dev,char *map_file,char *install,int delay, |
533 |
void bsect_open(char *boot_dev,char *map_file,char *install,int delay, |
| 532 |
int timeout, long raid_offset) |
534 |
int timeout, int raid_offset) |
| 533 |
{ |
535 |
{ |
| 534 |
static char coms[] = "0123"; |
536 |
static char coms[] = "0123"; |
| 535 |
static char parity[] = "NnOoEe"; |
537 |
static char parity[] = "NnOoEe"; |
|
Lines 546-552
Link Here
|
| 546 |
BITMAPFILEHEADER fhv; |
548 |
BITMAPFILEHEADER fhv; |
| 547 |
BITMAPHEADER bmhv; |
549 |
BITMAPHEADER bmhv; |
| 548 |
BITMAPLILOHEADER lhv; |
550 |
BITMAPLILOHEADER lhv; |
| 549 |
unsigned long timestamp; |
551 |
unsigned int timestamp; |
| 550 |
#ifdef LCF_BUILTIN |
552 |
#ifdef LCF_BUILTIN |
| 551 |
BUILTIN_FILE *loader; |
553 |
BUILTIN_FILE *loader; |
| 552 |
#else |
554 |
#else |
|
Lines 1054-1062
Link Here
|
| 1054 |
( (password = cfg_get_strg(cf_options,"password")) && |
1056 |
( (password = cfg_get_strg(cf_options,"password")) && |
| 1055 |
!cfg_get_flag(cf_all,"bypass") ) ) { |
1057 |
!cfg_get_flag(cf_all,"bypass") ) ) { |
| 1056 |
if (!*password) { /* null password triggers interaction */ |
1058 |
if (!*password) { /* null password triggers interaction */ |
| 1057 |
retrieve_crc((long*)descr->password_crc); |
1059 |
retrieve_crc((int*)descr->password_crc); |
| 1058 |
} else { |
1060 |
} else { |
| 1059 |
hash_password(password, (long*)descr->password_crc ); |
1061 |
hash_password(password, (int*)descr->password_crc ); |
| 1060 |
} |
1062 |
} |
| 1061 |
descr->flags |= FLAG_PASSWORD; |
1063 |
descr->flags |= FLAG_PASSWORD; |
| 1062 |
} |
1064 |
} |
|
Lines 1110-1116
Link Here
|
| 1110 |
} |
1112 |
} |
| 1111 |
#if 0 |
1113 |
#if 0 |
| 1112 |
#if 1 |
1114 |
#if 1 |
| 1113 |
*(unsigned long *) descr->rd_size = 0; /* no RAM disk */ |
1115 |
*(unsigned int *) descr->rd_size = 0; /* no RAM disk */ |
| 1114 |
#else |
1116 |
#else |
| 1115 |
descr->rd_size = 0; /* no RAM disk */ |
1117 |
descr->rd_size = 0; /* no RAM disk */ |
| 1116 |
#endif |
1118 |
#endif |
|
Lines 1235-1241
Link Here
|
| 1235 |
/* map_descrs(&descrs, bsect.par_1.descr, &bsect.par_1.dflcmd); */ |
1237 |
/* map_descrs(&descrs, bsect.par_1.descr, &bsect.par_1.dflcmd); */ |
| 1236 |
map_descrs(&descrs, menu->mt_descr, &bsect.par_1.dflcmd); |
1238 |
map_descrs(&descrs, menu->mt_descr, &bsect.par_1.dflcmd); |
| 1237 |
|
1239 |
|
| 1238 |
((long*)table)[SECTOR_SIZE/sizeof(long)-2] = crc32(table, SECTOR_SIZE-2*sizeof(long), CRC_POLY1); |
1240 |
((int*)table)[SECTOR_SIZE/sizeof(int)-2] = crc32(table, SECTOR_SIZE-2*sizeof(int), CRC_POLY1); |
| 1239 |
map_begin_section(); |
1241 |
map_begin_section(); |
| 1240 |
map_add_sector(table); |
1242 |
map_add_sector(table); |
| 1241 |
(void) map_write(&bsect.par_1.keytab,1,0); |
1243 |
(void) map_write(&bsect.par_1.keytab,1,0); |
|
Lines 1435-1441
Link Here
|
| 1435 |
} |
1437 |
} |
| 1436 |
|
1438 |
|
| 1437 |
|
1439 |
|
| 1438 |
void bsect_raid_update(char *boot_dev, unsigned long raid_offset, |
1440 |
void bsect_raid_update(char *boot_dev, unsigned int raid_offset, |
| 1439 |
char *backup_file, int force_backup, int pass) |
1441 |
char *backup_file, int force_backup, int pass) |
| 1440 |
{ |
1442 |
{ |
| 1441 |
BOOT_SECTOR bsect_save; |
1443 |
BOOT_SECTOR bsect_save; |