Changeset 116
- Timestamp:
- Feb 2, 2008, 7:30:01 AM (17 years ago)
- Location:
- branches/samba-3.0/source/ndpsmb
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/samba-3.0/source/ndpsmb/ndpsmb.c ¶
r111 r116 150 150 {ND_PROP_STRING, 0, "USER", "guest"}, 151 151 {ND_PROP_STRING, 0, "PASSWORD", ""}, 152 {ND_PROP_STRING, 0, "SPASSWORD", ""}, 152 153 {ND_PROP_STRING, 0, "MASTER", "WORKGROUP"}, 153 154 { ND_PROP_ULONG, 0, "MASTERTYPE", "1"}, … … 376 377 } 377 378 379 static unsigned char fromhex (char c) 380 { 381 if ('0' <= c && c <= '9') 382 { 383 return c - '0'; 384 } 385 386 if ('A' <= c && c <= 'F') 387 { 388 return c - 'A'; 389 } 390 391 if ('a' <= c && c <= 'f') 392 { 393 return c - 'a'; 394 } 395 396 return 0; 397 } 398 399 static char tohex (unsigned char b) 400 { 401 b &= 0xF; 402 403 if (b <= 9) 404 { 405 return b + '0'; 406 } 407 408 return 'A' + (b - 0xA); 409 } 410 411 static void decryptPassword (const char *pszCrypt, char *pszPlain) 412 { 413 /* A simple "decryption", character from the hex value. */ 414 const char *s = pszCrypt; 415 char *d = pszPlain; 416 417 while (*s) 418 { 419 *d++ = (char)((fromhex (*s++) << 4) + fromhex (*s++)); 420 } 421 422 *d++ = 0; 423 } 424 425 static void encryptPassword (const char *pszPlain, char *pszCrypt) 426 { 427 /* A simple "encryption" encode each character as hex value. */ 428 const char *s = pszPlain; 429 char *d = pszCrypt; 430 431 while (*s) 432 { 433 *d++ = tohex ((*s) >> 4); 434 *d++ = tohex (*s); 435 s++; 436 } 437 438 *d++ = 0; 439 } 378 440 379 441 /* accept parameters in form … … 386 448 const unsigned char * q = NULL; 387 449 HPIPE pipe; 450 int defaultPassword = 1; 388 451 389 452 pRes->memlen = 1 << 18; … … 429 492 { 430 493 StrNCpy(pRes->srv.password, q, sizeof(pRes->srv.password) - 1); 431 } 494 defaultPassword = 0; 495 } 496 497 t = 0, q = NULL; 498 rc = ph->fsphQueryStringProperty (pRes->properties, "SPASSWORD", &q, &t); 499 if ( rc == NO_ERROR 500 && *q != '\0' 501 && defaultPassword) 502 { 503 char p[1024]; 504 p[0] = 0; 505 506 decryptPassword (q, p); 507 508 if (*p) 509 { 510 StrNCpy(pRes->srv.password, p, sizeof(pRes->srv.password) - 1); 511 512 /* clear the plain password */ 513 ph->fsphSetProperty (pRes->properties, "PASSWORD", ""); 514 } 515 } 516 else 517 { 518 char c[1024]; 519 encryptPassword (pRes->srv.password, c); 520 521 ph->fsphSetProperty (pRes->properties, "SPASSWORD", c); 522 523 // clear the plain password 524 ph->fsphSetProperty (pRes->properties, "PASSWORD", ""); 525 } 432 526 433 527 t = 0, q = NULL; -
TabularUnified branches/samba-3.0/source/ndpsmb/rc/rc.dlg ¶
r110 r116 31 31 DT_BOTTOM 32 32 ENTRYFIELD "", ENT_PASS, 67, 70, 100, 8, ES_MARGIN | ES_UNREADABLE 33 ENTRYFIELD "", ENT_SPASS, 0, 0, 0, 0, ES_MARGIN | 34 ES_UNREADABLE | NOT WS_TABSTOP | NOT WS_VISIBLE 33 35 34 36 RTEXT "Master", LBL_MASTER, 5, 57, 30, 10, -
TabularUnified branches/samba-3.0/source/ndpsmb/rc/rc.h ¶
r110 r116 24 24 #define LBL_EASUPPORT 1021 25 25 #define CHK_EASUPPORT 1022 26 #define ENT_SPASS 1023 -
TabularUnified branches/samba-3.0/source/ndpsmb/rc/rc.rc ¶
r110 r116 145 145 RCDATA (DLG_ID + 11) 146 146 { 147 ENT_SPASS, PARMTYPE_STRING, 1L, 255L, "spassword", "%s", "" 148 } 149 150 RCDATA (DLG_ID + 12) 151 { 147 152 0 148 153 }
Note:
See TracChangeset
for help on using the changeset viewer.