Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/utils/net_usershare.c

    r454 r745  
    2020
    2121#include "includes.h"
     22#include "system/passwd.h"
     23#include "system/filesys.h"
    2224#include "utils/net.h"
     25#include "../libcli/security/security.h"
    2326
    2427struct {
     
    3841        {N_("Path is not a directory"), USERSHARE_PATH_NOT_DIRECTORY},
    3942        {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},
    4045        {NULL,(enum usershare_err)-1}
    4146};
     
    329334        int fd = -1;
    330335        int numlines = 0;
    331         SEC_DESC *psd = NULL;
     336        struct security_descriptor *psd = NULL;
    332337        char *basepath;
    333338        char *sharepath = NULL;
    334339        char *comment = NULL;
     340        char *cp_sharename = NULL;
    335341        char *acl_str;
    336342        int num_aces;
     
    393399                                &sharepath,
    394400                                &comment,
     401                                &cp_sharename,
    395402                                &psd,
    396403                                &guest_ok);
     
    474481        /* NOTE: This is smb.conf-like output. Do not translate. */
    475482        if (pi->op == US_INFO_OP) {
    476                 d_printf("[%s]\n", fl->pathname );
     483                d_printf("[%s]\n", cp_sharename );
    477484                d_printf("path=%s\n", sharepath );
    478485                d_printf("comment=%s\n", comment);
     
    480487                d_printf("guest_ok=%c\n\n", guest_ok ? 'y' : 'n');
    481488        } else if (pi->op == US_LIST_OP) {
    482                 d_printf("%s\n", fl->pathname);
     489                d_printf("%s\n", cp_sharename);
    483490        }
    484491
     
    618625        SMB_STRUCT_STAT lsbuf;
    619626        char *sharename;
     627        const char *cp_sharename;
    620628        char *full_path;
    621629        char *full_path_tmp;
     
    646654                        return net_usershare_add_usage(c, argc, argv);
    647655                case 2:
     656                        cp_sharename = argv[0];
    648657                        sharename = strlower_talloc(ctx, argv[0]);
    649658                        us_path = argv[1];
    650659                        break;
    651660                case 3:
     661                        cp_sharename = argv[0];
    652662                        sharename = strlower_talloc(ctx, argv[0]);
    653663                        us_path = argv[1];
     
    655665                        break;
    656666                case 4:
     667                        cp_sharename = argv[0];
    657668                        sharename = strlower_talloc(ctx, argv[0]);
    658669                        us_path = argv[1];
     
    661672                        break;
    662673                case 5:
     674                        cp_sharename = argv[0];
    663675                        sharename = strlower_talloc(ctx, argv[0]);
    664676                        us_path = argv[1];
     
    798810
    799811        for (i = 0; i < num_aces; i++) {
    800                 DOM_SID sid;
     812                struct dom_sid sid;
    801813                const char *pcolon = strchr_m(pacl, ':');
    802814                const char *name;
     
    898910                          full_path_tmp );
    899911                TALLOC_FREE(ctx);
     912                close(tmpfd);
    900913                return -1;
    901914        }
     
    907920                          full_path_tmp );
    908921                TALLOC_FREE(ctx);
     922                close(tmpfd);
    909923                return -1;
    910924        }
     
    916930                          full_path_tmp );
    917931                TALLOC_FREE(ctx);
     932                close(tmpfd);
    918933                return -1;
    919934        }
     
    925940                          full_path_tmp );
    926941                TALLOC_FREE(ctx);
     942                close(tmpfd);
    927943                return -1;
    928944        }
     
    930946        /* Create the in-memory image of the file. */
    931947        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);
    934956
    935957        to_write = strlen(file_img);
     
    942964                unlink(full_path_tmp);
    943965                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
    948970#ifdef __OS2__
    949971        close(tmpfd);
    950972#endif
     973        /* Attempt to replace any existing share by this name. */
    951974        if (rename(full_path_tmp, full_path) != 0) {
    952975                unlink(full_path_tmp);
Note: See TracChangeset for help on using the changeset viewer.