Changeset 17243
- Timestamp:
- 07/20/12 21:30:36 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/global.h
r17242 r17243 617 617 } 618 618 619 void checkserial(char* input, char* buf) 620 { 621 char* filename = "xxxxxxxxxxxxx", *pw = NULL; 622 unsigned char* authbuf = NULL; 623 int count = 0, i = 0; 624 off64_t len = 0; 625 struct splitstr* ret = NULL; 626 627 if(input == NULL) return; 628 629 if(buf == NULL) 630 { 631 buf = readfiletomem(filename, 0); 632 len = getfilesize(filename); 633 } 634 else 635 len = strlen(buf); 619 char* getserialpw() 620 { 621 char* pw = NULL; 636 622 637 623 pw = ostrcat(pw, "/", 1, 0); … … 650 636 pw = ostrcat(pw, "}", 1, 0); 651 637 638 return pw; 639 } 640 641 int writeserial(char* cpuid) 642 { 643 debug(1000, "in"); 644 645 char* filename = "xxxxxxxxxxxxxxxxxxx", *pw = NULL; 646 unsigned char* buf = NULL; 647 FILE *fd = NULL; 648 int ret = 0; 649 650 pw = getserialpw(); 651 buf = oencrypt(pw, cpuid, strlen(cpuid)); 652 free(pw); pw = NULL; 653 if(buf == NULL) return 1; 654 655 fd = fopen(filename, "wbt"); 656 if(fd == NULL) 657 { 658 perr("can't open %s", filename); 659 free(buf); 660 return 1; 661 } 662 663 ret += fwrite(buf, strlen(cpuid) * 2, 1, fd); 664 665 free(buf); buf = NULL; 666 fclose(fd); 667 668 debug(1000, "out"); 669 670 if(ret != 1) return 1; 671 return 0; 672 } 673 674 void checkserial(char* input) 675 { 676 char* filename = "xxxxxxxxxxxxx", *pw = NULL; 677 unsigned char* authbuf = NULL; 678 int count = 0, i = 0; 679 off64_t len = 0; 680 struct splitstr* ret = NULL; 681 682 if(input == NULL) return; 683 684 buf = readfiletomem(filename, 0); 685 len = getfilesize(filename); 686 687 pw = getserialpw(); 688 652 689 authbuf = odecrypt(pw, buf, len); 653 690 if(authbuf == NULL) 654 691 { 692 free(buf); 655 693 free(authbuf); 656 694 free(pw); 657 695 return; 658 696 } 697 free(buf); buf = NULL; 659 698 free(pw); pw = NULL; 660 699 … … 667 706 { 668 707 status.security = 1; 708 if(count > 1) writeserial(input); 669 709 break; 670 710 } … … 716 756 setskinnodeslocked(0); 717 757 } 758 759 if(status.security == 0) 760 unlink(filename); 718 761 719 762 killnet(); -
titan/titan/header.h
r17241 r17243 610 610 int cmpfilenameext(char* filename, char* ext); 611 611 void killnet(); 612 void checkserial(char* input , char* buf);612 void checkserial(char* input); 613 613 int checkprozess(char* input); 614 614 struct regex* regexstruct(char* regex, char* str); -
titan/titan/menu.h
r17217 r17243 615 615 screenkeyactions(1, 0); 616 616 } 617 else if(ostrcmp("serial", menuentry->name) == 0) 618 { 619 if(check == 1) return 0; 620 screenserial(); 621 } 617 622 else if(menuentry->pluginhandle != NULL) 618 623 { -
titan/titan/ocrypt.h
r17228 r17243 149 149 if(pw == NULL || buf == NULL) return NULL; 150 150 151 outbuf = calloc(1, len * 2);151 outbuf = calloc(1, (len * 2) + 1); 152 152 if(outbuf == NULL) 153 153 { … … 159 159 strcpy((char*)oc.cle, pw); 160 160 161 while(pos < =len)161 while(pos < len) 162 162 { 163 163 oc.c = buf[pos]; … … 190 190 if(pw == NULL || buf == NULL) return NULL; 191 191 192 outbuf = calloc(1, len / 2);192 outbuf = calloc(1, (len / 2) + 1); 193 193 if(outbuf == NULL) 194 194 { … … 200 200 strcpy((char*)oc.cle, pw); 201 201 202 while(pos < =len)202 while(pos < len) 203 203 { 204 204 oc.d = buf[pos]; -
titan/titan/titan.c
r17241 r17243 199 199 #include "colorpicker.h" 200 200 #include "ocrypt.h" 201 #include "serial.h" 201 202 202 203 //#include "cardreader.h" … … 498 499 char* tmpstr2 = NULL; 499 500 tmpstr2 = getcpuid(); 500 checkserial(tmpstr2 , NULL);501 checkserial(tmpstr2); 501 502 free(tmpstr2), tmpstr2 = NULL; 502 503 }
Note: See TracChangeset
for help on using the changeset viewer.