~ubuntu-branches/ubuntu/gutsy/samba/gutsy-updates

« back to all changes in this revision

Viewing changes to source/utils/smbtree.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2006-11-28 20:14:37 UTC
  • mfrom: (0.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128201437-a6x4lzlhempazocp
Tags: 3.0.23d-1ubuntu1
* Merge from debian unstable.
* Drop python2.4-samba, replace with python-samba. Added Conflicts/Replaces
  on python2.4-samba
* Drop track-connection-dos.patch, ubuntu-winbind-panic.patch, 
  ubuntu-fix-ldap.patch, ubuntu-setlocale.patch, ubuntu-setlocale-fixes.patch
* Remaining Ubuntu changes:
  - Revert Debian's installation of mount.cifs and umount.cifs as suid
  - Comment out the default [homes] shares and add more verbose comments to
    explain what they do and how they work (closes: launchpad.net/27608)
  - Add a "valid users = %S" stanza to the commented-out [homes] section, to
    show users how to restrict access to \\server\username to only username.
  - Change the (commented-out) "printer admin" example to use "@lpadmin"
    instead of "@ntadmin", since the lpadmin group is used for spool admin.
  - Alter the panic-action script to encourage users to report their
    bugs in Ubuntu packages to Ubuntu, rather than reporting to Debian.
    Modify text to more closely match the Debian script
  - Munge our init script to deal with the fact that our implementation
    (or lack thereof) of log_daemon_msg and log_progress_msg differs
    from Debian's implementation of the same (Ubuntu #19691)
  - Kept ubuntu-auxsrc.patch: some auxilliary sources (undocumented in 
    previous changelogs)
  - Set default workgroup to MSHOME

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        return True;
128
128
}
129
129
 
 
130
static BOOL get_rpc_shares(struct cli_state *cli, 
 
131
                           void (*fn)(const char *, uint32, const char *, void *),
 
132
                           void *state)
 
133
{
 
134
        NTSTATUS status;
 
135
        struct rpc_pipe_client *pipe_hnd;
 
136
        TALLOC_CTX *mem_ctx;
 
137
        ENUM_HND enum_hnd;
 
138
        WERROR werr;
 
139
        SRV_SHARE_INFO_CTR ctr;
 
140
        int i;
 
141
 
 
142
        mem_ctx = talloc_new(NULL);
 
143
        if (mem_ctx == NULL) {
 
144
                DEBUG(0, ("talloc_new failed\n"));
 
145
                return False;
 
146
        }
 
147
 
 
148
        init_enum_hnd(&enum_hnd, 0);
 
149
 
 
150
        pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status);
 
151
 
 
152
        if (pipe_hnd == NULL) {
 
153
                DEBUG(10, ("Could not connect to srvsvc pipe: %s\n",
 
154
                           nt_errstr(status)));
 
155
                TALLOC_FREE(mem_ctx);
 
156
                return False;
 
157
        }
 
158
 
 
159
        werr = rpccli_srvsvc_net_share_enum(pipe_hnd, mem_ctx, 1, &ctr,
 
160
                                            0xffffffff, &enum_hnd);
 
161
 
 
162
        if (!W_ERROR_IS_OK(werr)) {
 
163
                TALLOC_FREE(mem_ctx);
 
164
                cli_rpc_pipe_close(pipe_hnd);
 
165
                return False;
 
166
        }
 
167
 
 
168
        for (i=0; i<ctr.num_entries; i++) {
 
169
                SRV_SHARE_INFO_1 *info = &ctr.share.info1[i];
 
170
                char *name, *comment;
 
171
                name = rpcstr_pull_unistr2_talloc(
 
172
                        mem_ctx, &info->info_1_str.uni_netname);
 
173
                comment = rpcstr_pull_unistr2_talloc(
 
174
                        mem_ctx, &info->info_1_str.uni_remark);
 
175
                fn(name, info->info_1.type, comment, state);
 
176
        }
 
177
 
 
178
        TALLOC_FREE(mem_ctx);
 
179
        cli_rpc_pipe_close(pipe_hnd);
 
180
        return True;
 
181
}
 
182
 
 
183
 
130
184
static BOOL get_shares(char *server_name, struct user_auth_info *user_info)
131
185
{
132
186
        struct cli_state *cli;
134
188
        if (!(cli = get_ipc_connect(server_name, NULL, user_info)))
135
189
                return False;
136
190
 
 
191
        if (get_rpc_shares(cli, add_name, &shares))
 
192
                return True;
 
193
        
137
194
        if (!cli_RNetShareEnum(cli, add_name, &shares))
138
195
                return False;
139
196
 
216
273
        while(poptGetNextOpt(pc) != -1);
217
274
        poptFreeContext(pc);
218
275
 
219
 
        lp_load(dyn_CONFIGFILE,True,False,False);
 
276
        lp_load(dyn_CONFIGFILE,True,False,False,True);
220
277
        load_interfaces();
221
278
 
222
279
        /* Parse command line args */