1/* 2 Copyright 2001, Broadcom Corporation 3 All Rights Reserved. 4 5 This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; 6 the contents of this file may not be disclosed to third parties, copied or 7 duplicated in any form, in whole or in part, without the prior written 8 permission of Broadcom Corporation. 9*/ 10/* 11 * This module creates an array of name, value pairs 12 * and supports updating the nvram space. 13 * 14 * This module requires the following support routines 15 * 16 * malloc, free, strcmp, strncmp, strcpy, strtol, strchr, printf and sprintf 17 */ 18 19#include <string.h> 20#include <stdio.h> 21#include <stdlib.h> 22#include <syslog.h> 23//#include <typedefs.h> 24#include <bcmnvram.h> 25#include <sys/mman.h> 26#ifdef REMOVE_WL600 27#include <bcmutils.h> 28#include <sbsdram.h> 29#include <bcmendian.h> 30#include <bcmnvram_f.h> 31#include <flash.h> 32#include <flashutl.h> 33#include <osl.h> 34#endif 35 36 37#define MAX_LINE_SIZE 512 38#define MAX_FILE_NAME 64 39 40char *workingDir="/etc/linuxigd"; 41 42 43/* Linked list of environment variables */ 44typedef struct nvram_tuple EnvRec; 45static EnvRec curEnv; 46 47#ifndef NOUSB 48 void del_right_list(char *user); 49#endif 50 51/* 52 * NOTE : The mutex must be initialized in the OS previous to the point at 53 * which multiple entry points to the nvram code are enabled 54 * 55 */ 56#define MAX_NVRAM_SIZE 4096 57#define EPI_VERSION_STR "2.4.5" 58 59#ifndef NOUSB 60/* Remove CR/LF/Space in the end of string 61 * 62 */ 63 64char *strtrim(char *str) 65{ 66 int i; 67 68 i=strlen(str)-1; 69 70 while(i>=0) 71 { 72 if (*(str+i)==13 || *(str+i)==10 || *(str+i)==' ') 73 { 74 *(str+i)=0x0; 75 } 76 else if (*(str+i)=='"') 77 { 78 *(str+i)=0x0; 79 break; 80 } 81 else break; 82 i--; 83 } 84 85 return (str); 86} 87 88char *strtrim_c(char *str) 89{ 90 int i; 91 92 return(str); 93 94#ifdef REMOVE 95 i=strlen(str)-1; 96 97 while(i>0) 98 { 99 if (*(str+i)==';') 100 { 101 *(str+i)=0x0; 102 break; 103 } 104 i--; 105 } 106 return (str); 107#endif 108} 109 110 111int nvram_set_item(EnvRec *env, char *name, char *value) 112{ 113 if (env->name) free(env->name); 114 if (env->value) free(env->value); 115 116 env->name = (char*)malloc(strlen(name)+1); 117 if (!env->name) goto err; 118 strcpy(env->name, name); 119 env->value = (char*)malloc(strlen(value)+1); 120 if (!env->value) goto err; 121 strcpy(env->value, value); 122 return (1); 123err: 124 if (env->name) free(env->name); 125 if (env->value) free(env->value); 126 return (0); 127} 128 129int nvram_add_item(EnvRec *env, char *name, char *value) 130{ 131 EnvRec *orig; 132 133 if (env->next!=NULL) orig = env->next; 134 else orig = NULL; 135 env->next = (EnvRec*)malloc(sizeof(EnvRec)); 136 if (!env->next) return(0); 137 env->next->name = NULL; 138 env->next->value = NULL; 139 if (nvram_set_item(env->next, name, value)==0) goto err; 140 141#ifdef REMOVE_WL600 142 if (orig!=NULL) 143 printf("Add between %s %s %s\n", env->name, env->next->name, orig->name); 144#endif 145 env->next->next = orig; 146 147 return(1); 148 149err: 150 if (env->next) free(env->next); 151 if (orig) env->next = orig; 152 return(0); 153} 154#endif 155 156/* 157 * Set the value of an NVRAM variable 158 * @param name name of variable to set 159 * @param value value of variable 160 * @return 0 on success and errno on failure 161 */ 162int 163nvram_set_x(const char *sid, const char *name, const char *value) 164{ 165 return(nvram_set(name, value)); 166} 167 168 169/* 170 * Get the value of an NVRAM variable 171 * @param name name of variable to get 172 * @return value of variable or NULL if undefined 173 */ 174char* 175nvram_get_x(const char *sid, const char *name) 176{ 177 return(nvram_safe_get(name)); 178} 179 180 181/* 182 * Get the value of an NVRAM variable 183 * @param name name of variable to get 184 * @return value of variable or NULL if undefined 185 */ 186char* 187nvram_get_f(const char *file, const char *field) 188{ 189 return(nvram_safe_get(field)); 190} 191 192/* 193 * Set the value of an NVRAM variable from file 194 * @param name name of variable to get 195 * @return value of variable or NULL if undefined 196 */ 197int 198nvram_set_f(const char *file, const char *field, const char *value) 199{ 200 return(nvram_set(field, value)); 201} 202 203/* 204 * Get the value of an NVRAM variable list 205 * @param name name of variable to get 206 * index index of the list, start from 1 207 * @return value of variable or NULL if undefined 208 */ 209 210char *nvram_get_list_x(const char *sid, const char *name, int index) 211{ 212 char new_name[MAX_LINE_SIZE]; 213 214 sprintf(new_name, "%s%d", name, index); 215 216 return(nvram_get_f(sid, new_name)); 217#ifdef OLD_DESIGN 218 static char value[MAX_LINE_SIZE]; 219 char *v, *buf; 220 int i; 221 222 strcpy(value, nvram_get_f(sid, name)); 223 224 if (value[0]=='\0') 225 return(value); 226 227 buf = value; 228 v = strchr(buf, ';'); 229 /*syslog(LOG_INFO,"Get %s %s %d\n", v, buf, index);*/ 230 231 i = 0; 232 while (v!=NULL) 233 { 234 if (i==index-1) 235 { 236 *v = '\0'; 237 return(buf); 238 } 239 /*syslog(LOG_INFO, "Get %s %s\n", v, buf);*/ 240 buf = v+1; 241 v = strchr(buf, ';'); 242 i++; 243 } 244 if ( i==0 && index==1) 245 return(value); 246 else if (i==(index-1)) 247 return(buf); 248 249 value[0] = '\0'; 250 return(value); 251#endif 252} 253 254#ifdef REMOVE_NVRAM 255/* 256 * Add the value into the end an NVRAM variable list 257 * @param name name of variable to get 258 * @return 0 on success and errno on failure 259 */ 260int nvram_add_list_x(const char *sid, const char *name, const char *value) 261{ 262 FILE *fl, *flTemp; 263 char buf[MAX_LINE_SIZE]; 264 char new_buf[MAX_LINE_SIZE]; 265 char filename[MAX_FILE_NAME]; 266 unsigned char *v, *sp; 267 int found; 268 269 sprintf(filename, "%s/%s", workingDir, sid); 270 if ((fl=fopen(filename,"r+"))==NULL) return 1; 271 if ((flTemp=fopen("/tmp/temp.cfg","w+"))==NULL) return 1; 272 273 found = 0; 274 while(fgets(buf, MAX_LINE_SIZE, fl)) 275 { 276 v = strchr(buf, '='); 277 if (v != NULL && ((sp = strchr(buf, ' ')) == NULL || (sp > v))) { 278 /* change the "name=val" string to "set name val" */ 279 if (!strncmp(buf, name, strlen(name)) && buf[strlen(name)]=='=') 280 { 281 found++; 282 } 283 else if (found) 284 { 285 if (value!=NULL) 286 { 287 sprintf(new_buf, "%s%d=\"%s\"\n", name, found-1, value); 288 fputs(new_buf, flTemp); 289 } 290 found = 0; 291 } 292 fputs(buf,flTemp); 293 } 294 } 295 296 fclose(fl); 297 fclose(flTemp); 298 299 if ((fl=fopen(filename,"w+"))==NULL) return 1; 300 if ((flTemp=fopen("/tmp/temp.cfg","r+"))==NULL) return 1; 301 302 while(fgets(buf, MAX_LINE_SIZE, flTemp)) 303 { 304 fputs(buf, fl); 305 } 306 fclose(fl); 307 fclose(flTemp); 308 309 return(0); 310 311 312#ifdef OLD_DESIGN 313 char buf[MAX_LINE_SIZE]; 314 char *orig; 315 316 orig = strtrim(nvram_get_f(sid, name)); 317 318 if (strcmp(orig,"")==0) 319 sprintf(buf, "%s;", value); 320 else 321 sprintf(buf, "%s%s;", orig, value); 322 323 syslog(LOG_INFO,"ADD: [%x] [%s] [%s]\n", *orig, value, buf); 324 325 nvram_set_x(sid, name, buf); 326#endif 327} 328#endif 329 330/* 331 * Add the value into the end an NVRAM variable list 332 * @param name name of variable to get 333 * @return 0 on success and errno on failure 334 */ 335int nvram_add_lists_x(const char *sid, const char *name, const char *value, int count) 336{ 337#ifndef REMOVE_NVRAM 338 char name1[32], name2[32]; 339 340#ifdef NOUSB 341 strcpy(name1, name); 342#else 343 findNVRAMName(sid, name, name1); 344#endif 345 346 if (name[0]!='\0') 347 { 348 sprintf(name2, "%s%d", name1, count); 349 nvram_set(name2, value); 350 } 351#else 352 FILE *fl, *flTemp; 353 char buf[MAX_LINE_SIZE]; 354 char new_buf[MAX_LINE_SIZE]; 355 char new_buf1[MAX_LINE_SIZE]; 356 char filename[MAX_FILE_NAME]; 357 unsigned char *v, *sp; 358 int found; 359 360 sprintf(filename, "%s/%s", workingDir, sid); 361 if ((fl=fopen(filename,"r+"))==NULL) return 1; 362 if ((flTemp=fopen("/tmp/temp.cfg","w+"))==NULL) return 1; 363 364 if (count==0) 365 sprintf(new_buf, "%s=", name); 366 else 367 sprintf(new_buf, "%s%d=", name, count-1); 368 369 sprintf(new_buf1, "%s%d=", name, count); 370 371 found = 0; 372 373 while(fgets(buf, MAX_LINE_SIZE, fl)) 374 { 375 v = strchr(buf, '='); 376 if (v != NULL && ((sp = strchr(buf, ' ')) == NULL || (sp > v))) { 377 /* change the "name=val" string to "set name val" */ 378 if (!strncmp(buf, new_buf, strlen(new_buf))) /* Find the previous record */ 379 { 380 if (!found) /* If not added yet */ 381 { 382 fputs(buf, flTemp); /* Write this record */ 383 384 if (value!=NULL) /* Add new record */ 385 { 386 sprintf(new_buf, "%s%d=\"%s\"\n", name, count, value); 387 fputs(new_buf, flTemp); 388 found = 1; 389 sprintf(new_buf, "%s%d=", name, count); /* Maintain the buf of new reocrd */ 390 } 391 } 392 } 393 else if (strncmp(buf, new_buf1, strlen(new_buf1))!=0) 394 fputs(buf,flTemp); 395 } 396 } 397 398 fclose(fl); 399 fclose(flTemp); 400 401 if ((fl=fopen(filename,"w+"))==NULL) return 1; 402 if ((flTemp=fopen("/tmp/temp.cfg","r+"))==NULL) return 1; 403 404 while(fgets(buf, MAX_LINE_SIZE, flTemp)) 405 { 406 fputs(buf, fl); 407 } 408 fclose(fl); 409 fclose(flTemp); 410#endif 411 return(0); 412 413 414#ifdef OLD_DESIGN 415 char buf[MAX_LINE_SIZE]; 416 char *orig; 417 418 orig = strtrim(nvram_get_f(sid, name)); 419 420 if (strcmp(orig,"")==0) 421 sprintf(buf, "%s;", value); 422 else 423 sprintf(buf, "%s%s;", orig, value); 424 425 syslog(LOG_INFO,"ADD: [%x] [%s] [%s]\n", *orig, value, buf); 426 427 nvram_set_x(sid, name, buf); 428#endif 429} 430 431 432#ifdef REMOVE_NVRAM 433/* 434 * Delete the value from an NVRAM variable list 435 * @param name name of variable list 436 * index index of variable list 437 * @return 0 on success and errno on failure 438 */ 439int nvram_del_list_x(const char *sid, const char *name, int index) 440{ 441#ifdef REMOVE_WL600 442 char value[MAX_LINE_SIZE]; 443 char *v, *buf; 444 int i; 445 446 strcpy(value, nvram_get_f(sid, name)); 447 448 /*syslog(LOG_INFO, "Get list : %s %d\n", value, index);*/ 449 450 if (value[0]=='\0') 451 return(1); 452 453 buf = value; 454 v = strchr(buf, ';'); 455 456 i = 0; 457 while (v!=NULL) 458 { 459 /* syslog(LOG_INFO, "Check list : %s %d %d\n", value, index, i);*/ 460 if (i==index-1) 461 { 462 *v++ = '\0'; 463 strcpy(buf, v); 464 /*syslog(LOG_INFO, "Set list : %s\n", value);*/ 465 nvram_set_x(sid, name, value); 466 return(0); 467 } 468 buf = v+1; 469 v = strchr(buf, ';'); 470 i++; 471 } 472 return(1); 473#endif 474} 475#endif 476 477/* 478 * Delete the value from an NVRAM variable list 479 * @param name name of variable list 480 * index index of variable list 481 * @return 0 on success and errno on failure 482 */ 483int nvram_del_lists_x(const char *sid, const char *name, int *delMap) 484{ 485#ifndef REMOVE_NVRAM 486 487 FILE *fp; 488 char names[32], oname[32], nname[32], *oval, *nval; 489 int oi, ni, di; 490 491#ifdef NOUSB 492 strcpy(names, name); 493#else 494 findNVRAMName(sid, name, names); 495#endif 496 497#ifndef NOUSB 498 if(!strcmp(name,"acc_username")) 499 { 500 int i=0; 501 char delname[32],namevalue[32]; 502 //char *namevalue; 503 504 while(delMap[i]!=-1) 505 { 506 sprintf(delname,"%s%d",name,delMap[i]); 507//Yau 508printf("delname=%s\n",delname); 509 strcpy(namevalue,nvram_get(delname)); 510 //namevalue=nvram_get(delname); 511//Yau 512printf("del_list_x:: name: %s = %s\n",delname,namevalue); 513 514 del_right_list(namevalue); 515 i++; 516 } 517 } 518#endif 519 520 if (names[0]!='\0') 521 { 522 oi=0; 523 ni=0; 524 di=0; 525 while(1) 526 { 527 sprintf(oname, "%s%d", names, oi); 528 sprintf(nname, "%s%d", names, ni); 529 530 oval = nvram_get(oname); 531 nval = nvram_get(nname); 532 533 if (oval==NULL) break; 534 535 printf("d: %d %d %d %d\n", oi, ni, di, delMap[di]); 536 if (delMap[di]!=-1&&delMap[di]==oi) 537 { 538 oi++; 539 di++; 540 } 541 else 542 { 543 nvram_set(nname, oval); 544 ni++; 545 oi++; 546 } 547 } 548 } 549#else 550 FILE *fl, *flTemp; 551 char buf[MAX_LINE_SIZE]; 552 char new_buf[MAX_LINE_SIZE]; 553 char filename[MAX_FILE_NAME]; 554 unsigned char *v, *sp; 555 int found, count, i, del; 556 557 sprintf(filename, "%s/%s", workingDir, sid); 558 if ((fl=fopen(filename,"r+"))==NULL) return 1; 559 if ((flTemp=fopen("/tmp/temp.cfg","w+"))==NULL) return 1; 560 561 count = 0; 562 563 del = 0; 564 565 while(fgets(buf, MAX_LINE_SIZE, fl)) 566 { 567 v = strchr(buf, '='); 568 if (v != NULL && ((sp = strchr(buf, ' ')) == NULL || (sp > v))) { 569 /* change the "name=val" string to "set name val" */ 570 if (!strncmp(buf, name, strlen(name)) && buf[strlen(name)]!='=') 571 { 572 i = strlen(name); 573 574 if (buf[i]>='0' && buf[i]<='9') 575 found = buf[i] - '0'; 576 else 577 continue; 578 579 if (buf[i+1]>='0' && buf[i+1]<='9') 580 { 581 found = found*10 + buf[i+1] - '0'; 582 583 if (buf[i+2]>='0' && buf[i+2]<='9') 584 found = found*10 + buf[i+2] - '0'; 585 else if (buf[i+2]!='=') 586 continue; 587 } 588 else if (buf[i+1]!='=') 589 continue; 590 591 /*printf("Del : %d %d %d\n", del, delMap[del], found); */ 592 593 if ( delMap[del]!=-1 && delMap[del]==found) 594 { 595 del++; 596 continue; 597 } 598 599 v++; 600 601 if (*v=='"') 602 v++; 603 604 sprintf(new_buf, "%s%d=\"%s\"\n", name, count, v); 605 fputs(new_buf, flTemp); 606 607 count++; 608 } 609 else 610 { 611 fputs(buf,flTemp); 612 } 613 614 } 615 } 616 617 fclose(fl); 618 fclose(flTemp); 619 620 if ((fl=fopen(filename,"w+"))==NULL) return 1; 621 if ((flTemp=fopen("/tmp/temp.cfg","r+"))==NULL) return 1; 622 623 while(fgets(buf, MAX_LINE_SIZE, flTemp)) 624 { 625 fputs(buf, fl); 626 } 627 fclose(fl); 628 fclose(flTemp); 629#endif 630 631 return(0); 632 633#ifdef REMOVE_WL600 634 char value[MAX_LINE_SIZE]; 635 char *v, *buf; 636 int i; 637 638 strcpy(value, nvram_get_f(sid, name)); 639 640 /*syslog(LOG_INFO, "Get list : %s %d\n", value, index);*/ 641 642 if (value[0]=='\0') 643 return(1); 644 645 buf = value; 646 v = strchr(buf, ';'); 647 648 i = 0; 649 while (v!=NULL) 650 { 651 /* syslog(LOG_INFO, "Check list : %s %d %d\n", value, index, i);*/ 652 if (i==index-1) 653 { 654 *v++ = '\0'; 655 strcpy(buf, v); 656 /*syslog(LOG_INFO, "Set list : %s\n", value);*/ 657 nvram_set_x(sid, name, value); 658 return(0); 659 } 660 buf = v+1; 661 v = strchr(buf, ';'); 662 i++; 663 } 664 return(1); 665#endif 666} 667 668#ifndef NOUSB 669int nvram_add_right_list(const char *name, const char *value1, const char *value2) 670{ 671 int count, list_no; 672 char rright[205], wright[205], username[205]; 673 char onlist_num[2]; 674 675 count = atoi(nvram_get("sh_edit_x")); 676 list_no = atoi(nvram_get_i("sh_acc_onlist_num",count)); 677//Yau 678 strcpy(username, nvram_get_i("sh_acc_user", count)); 679 680 sprintf(username, "%s%s;",username, value1); 681//Yau 682 nvram_set_i("sh_acc_user",count,username); 683 684 if( strcmp("1",value2)==0) // read only 685 { 686 strcpy(rright, nvram_get_i("sh_rright", count)); 687 sprintf(rright, "%s%s;", rright, value1); 688 nvram_set_i("sh_rright",count,rright); 689//Yau 690 } 691 else // read/write 692 { 693 strcpy(rright, nvram_get_i("sh_rright", count)); 694 sprintf(rright, "%s%s;", rright, value1); 695 nvram_set_i("sh_rright",count,rright); 696 697 strcpy(wright, nvram_get_i("sh_wright", count)); 698 sprintf(wright, "%s%s;", wright, value1); 699 nvram_set_i("sh_wright",count,wright); 700//Yau 701 } 702 703 sprintf(onlist_num,"%d",(list_no+1)); 704 nvram_set_i("sh_acc_onlist_num", count, onlist_num); 705 nvram_set("sh_acc_onlist_num_x", onlist_num); 706 nvram_set("sh_acc_user_x", username); 707 return(0); 708} 709 710int nvram_remove_right_list(int *delMap) 711{ 712 int sh_edit, i=0, j, tmp2=0, list_no; 713 char *user, *p; 714 char rright[205], wright[205], username[205]; 715 char tmp_user[205]; 716 char buf_user[205]; 717 char buf_rright[205]; 718 char buf_wright[205]; 719 char onlist_num[2]; 720 721 sh_edit = atoi(nvram_get("sh_edit_x")); 722 list_no = atoi(nvram_get_i("sh_acc_onlist_num",sh_edit)); 723//Yau 724printf("++++ remove_right_list ++++ %d\n",sh_edit); 725 726 strcpy(buf_user, nvram_get_i("sh_acc_user", sh_edit)); 727 strcpy(buf_rright, nvram_get_i("sh_rright", sh_edit)); 728 strcpy(buf_wright, nvram_get_i("sh_wright", sh_edit)); 729//find user name and del it 730 while(delMap[i]!=-1) 731 { 732 j=0; 733 tmp2=delMap[i]-i; 734 strcpy(tmp_user, buf_user); 735 user = strtok(tmp_user, ";"); 736 if(tmp2!=0) 737 { 738 while(user=strtok(NULL,";")) 739 { 740 j++; 741 if(tmp2==j) break; 742 } 743 } 744//Yau 745//del the user name 746 p=strstr(buf_user, user); 747 *p='\0'; 748 strcpy(username, buf_user); 749 sprintf(username,"%s%s",username,p+strlen(user)+1); 750 strcpy(buf_user, username); 751 752 p=strstr(buf_rright, user); 753 *p='\0'; 754 strcpy(rright, buf_rright); 755 sprintf(rright,"%s%s",rright,p+strlen(user)+1); 756 strcpy(buf_rright, rright); 757 758 p=strstr(buf_wright, user); 759 if(p!=NULL) 760 { 761 *p='\0'; 762 strcpy(wright, buf_wright); 763 sprintf(wright,"%s%s",wright,p+strlen(user)+1); 764 strcpy(buf_wright, wright); 765 } 766 767 i++; 768 } 769 770 sprintf(onlist_num,"%d",list_no-i); 771 //Set to Nvram 772 nvram_set_i("sh_acc_onlist_num",sh_edit, onlist_num); 773 nvram_set("sh_acc_onlist_num_x", onlist_num); 774 nvram_set_i("sh_acc_user",sh_edit,buf_user); 775 nvram_set_i("sh_rright",sh_edit,buf_rright); 776 nvram_set_i("sh_wright",sh_edit,buf_wright); 777 nvram_set("sh_acc_user_x",buf_user); 778 779 return(0); 780} 781 782 783int nvram_modify_right_list(char *user, int right) 784{ 785 int sh_edit; 786 char *p; 787 char wright[205]; 788 char buf_wright[205]; 789 790 sh_edit = atoi(nvram_get("sh_edit_x")); 791//Yau 792printf("++++ modify_right_list ++++ %d\n",sh_edit); 793 794 strcpy(buf_wright, nvram_get_i("sh_wright", sh_edit)); 795 if(right==1)//read only 796 { 797 p=strstr(buf_wright, user); 798 if(p!=NULL) 799 { 800 *p='\0'; 801 strcpy(wright, buf_wright); 802 sprintf(wright,"%s%s",wright,p+strlen(user)+1); 803 strcpy(buf_wright, wright); 804 } 805 } 806 else // read/write 807 { 808 p=strstr(buf_wright, user); 809 if(p==NULL) 810 { 811 sprintf(buf_wright, "%s%s;", buf_wright, user); 812 } 813 } 814 //write to nvram 815 nvram_set_i("sh_wright",sh_edit,buf_wright); 816 817 return (0); 818} 819 820// 2005.12.26 yau add for: when del the users in the user list 821// also need to del these in all access right lists 822void del_right_list(char *deluser) 823{ 824 int sh_num, sh_modify=0i; 825 char *p; 826 char wright[205], username[205]; 827 char buf_user[205]; 828 //char buf_rright[205]; 829 char buf_wright[205]; 830 831 sh_num = atoi(nvram_get("sh_num")); 832 833printf("del User Name: %s, \n", deluser); 834 835 while(sh_modify < sh_num) 836 { 837 strcpy(buf_user, nvram_get_i("sh_acc_user", sh_modify)); 838 //strcpy(buf_rright, nvram_get_i("sh_rright", sh_modify)); 839 strcpy(buf_wright, nvram_get_i("sh_wright", sh_modify)); 840//del the user 841 p=strstr(buf_user, deluser); 842 if(p!=NULL) 843 { 844 *p='\0'; 845 strcpy(username, buf_user); 846 sprintf(username,"%s%s",username,p+strlen(deluser)+1); 847 strcpy(buf_user, username); 848 } 849 850 p=strstr(buf_wright, deluser); 851 if(p!=NULL) 852 { 853 *p='\0'; 854 strcpy(wright, buf_wright); 855 sprintf(wright,"%s%s",wright,p+strlen(deluser)+1); 856 strcpy(buf_wright, wright); 857 } 858 //Set to Nvram 859 nvram_set_i("sh_acc_user",sh_modify,buf_user); 860 nvram_set_i("sh_rright",sh_modify,buf_user); 861 nvram_set_i("sh_wright",sh_modify,buf_wright); 862 sh_modify++; 863 } 864} 865#endif 866