Changeset 745 for trunk/server/source3/utils/net_usershare.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/utils/net_usershare.c
r454 r745 20 20 21 21 #include "includes.h" 22 #include "system/passwd.h" 23 #include "system/filesys.h" 22 24 #include "utils/net.h" 25 #include "../libcli/security/security.h" 23 26 24 27 struct { … … 38 41 {N_("Path is not a directory"), USERSHARE_PATH_NOT_DIRECTORY}, 39 42 {N_("System error"), USERSHARE_POSIX_ERR}, 43 {N_("Malformed sharename definition"), USERSHARE_MALFORMED_SHARENAME_DEF}, 44 {N_("Bad sharename (doesn't match filename)"), USERSHARE_BAD_SHARENAME}, 40 45 {NULL,(enum usershare_err)-1} 41 46 }; … … 329 334 int fd = -1; 330 335 int numlines = 0; 331 SEC_DESC*psd = NULL;336 struct security_descriptor *psd = NULL; 332 337 char *basepath; 333 338 char *sharepath = NULL; 334 339 char *comment = NULL; 340 char *cp_sharename = NULL; 335 341 char *acl_str; 336 342 int num_aces; … … 393 399 &sharepath, 394 400 &comment, 401 &cp_sharename, 395 402 &psd, 396 403 &guest_ok); … … 474 481 /* NOTE: This is smb.conf-like output. Do not translate. */ 475 482 if (pi->op == US_INFO_OP) { 476 d_printf("[%s]\n", fl->pathname );483 d_printf("[%s]\n", cp_sharename ); 477 484 d_printf("path=%s\n", sharepath ); 478 485 d_printf("comment=%s\n", comment); … … 480 487 d_printf("guest_ok=%c\n\n", guest_ok ? 'y' : 'n'); 481 488 } else if (pi->op == US_LIST_OP) { 482 d_printf("%s\n", fl->pathname);489 d_printf("%s\n", cp_sharename); 483 490 } 484 491 … … 618 625 SMB_STRUCT_STAT lsbuf; 619 626 char *sharename; 627 const char *cp_sharename; 620 628 char *full_path; 621 629 char *full_path_tmp; … … 646 654 return net_usershare_add_usage(c, argc, argv); 647 655 case 2: 656 cp_sharename = argv[0]; 648 657 sharename = strlower_talloc(ctx, argv[0]); 649 658 us_path = argv[1]; 650 659 break; 651 660 case 3: 661 cp_sharename = argv[0]; 652 662 sharename = strlower_talloc(ctx, argv[0]); 653 663 us_path = argv[1]; … … 655 665 break; 656 666 case 4: 667 cp_sharename = argv[0]; 657 668 sharename = strlower_talloc(ctx, argv[0]); 658 669 us_path = argv[1]; … … 661 672 break; 662 673 case 5: 674 cp_sharename = argv[0]; 663 675 sharename = strlower_talloc(ctx, argv[0]); 664 676 us_path = argv[1]; … … 798 810 799 811 for (i = 0; i < num_aces; i++) { 800 DOM_SIDsid;812 struct dom_sid sid; 801 813 const char *pcolon = strchr_m(pacl, ':'); 802 814 const char *name; … … 898 910 full_path_tmp ); 899 911 TALLOC_FREE(ctx); 912 close(tmpfd); 900 913 return -1; 901 914 } … … 907 920 full_path_tmp ); 908 921 TALLOC_FREE(ctx); 922 close(tmpfd); 909 923 return -1; 910 924 } … … 916 930 full_path_tmp ); 917 931 TALLOC_FREE(ctx); 932 close(tmpfd); 918 933 return -1; 919 934 } … … 925 940 full_path_tmp ); 926 941 TALLOC_FREE(ctx); 942 close(tmpfd); 927 943 return -1; 928 944 } … … 930 946 /* Create the in-memory image of the file. */ 931 947 file_img = talloc_strdup(ctx, "#VERSION 2\npath="); 932 file_img = talloc_asprintf_append(file_img, "%s\ncomment=%s\nusershare_acl=%s\nguest_ok=%c\n", 933 us_path, us_comment, us_acl, guest_ok ? 'y' : 'n'); 948 file_img = talloc_asprintf_append(file_img, 949 "%s\ncomment=%s\nusershare_acl=%s\n" 950 "guest_ok=%c\nsharename=%s\n", 951 us_path, 952 us_comment, 953 us_acl, 954 guest_ok ? 'y' : 'n', 955 cp_sharename); 934 956 935 957 to_write = strlen(file_img); … … 942 964 unlink(full_path_tmp); 943 965 TALLOC_FREE(ctx); 944 return -1;945 }946 947 /* Attempt to replace any existing share by this name. */ 966 close(tmpfd); 967 return -1; 968 } 969 948 970 #ifdef __OS2__ 949 971 close(tmpfd); 950 972 #endif 973 /* Attempt to replace any existing share by this name. */ 951 974 if (rename(full_path_tmp, full_path) != 0) { 952 975 unlink(full_path_tmp);
Note:
See TracChangeset
for help on using the changeset viewer.