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

« back to all changes in this revision

Viewing changes to source/libsmb/clierror.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:
201
201
void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
202
202
{
203
203
        int  flgs2;
204
 
        char rcls;
205
 
        int code;
206
204
 
207
205
        if(!cli->initialised) {
208
206
                return;
223
221
                return;
224
222
        }
225
223
 
226
 
        rcls  = CVAL(cli->inbuf,smb_rcls);
227
 
        code  = SVAL(cli->inbuf,smb_err);
228
 
 
229
 
        if (eclass) *eclass = rcls;
230
 
        if (ecode) *ecode    = code;
231
 
}
232
 
 
233
 
/****************************************************************************
234
 
 The following mappings need tidying up and moving into libsmb/errormap.c...
235
 
****************************************************************************/
236
 
 
237
 
/* Return a UNIX errno from a dos error class, error number tuple */
238
 
 
239
 
static int cli_errno_from_dos(uint8 eclass, uint32 num)
240
 
{
241
 
        if (eclass == ERRDOS) {
242
 
                switch (num) {
243
 
                case ERRbadfile: return ENOENT;
244
 
                case ERRbadpath: return ENOTDIR;
245
 
                case ERRnoaccess: return EACCES;
246
 
                case ERRfilexists: return EEXIST;
247
 
                case ERRrename: return EEXIST;
248
 
                case ERRbadshare: return EBUSY;
249
 
                case ERRlock: return EBUSY;
250
 
                case ERRinvalidname: return ENOENT;
251
 
                case ERRnosuchshare: return ENODEV;
252
 
                }
253
 
        }
254
 
 
255
 
        if (eclass == ERRSRV) {
256
 
                switch (num) {
257
 
                case ERRbadpw: return EPERM;
258
 
                case ERRaccess: return EACCES;
259
 
                case ERRnoresource: return ENOMEM;
260
 
                case ERRinvdevice: return ENODEV;
261
 
                case ERRinvnetname: return ENODEV;
262
 
                }
263
 
        }
264
 
 
265
 
        /* for other cases */
266
 
        return EINVAL;
 
224
        *eclass  = CVAL(cli->inbuf,smb_rcls);
 
225
        *ecode  = SVAL(cli->inbuf,smb_err);
267
226
}
268
227
 
269
228
/* Return a UNIX errno from a NT status code */
405
364
 
406
365
int cli_errno(struct cli_state *cli)
407
366
{
 
367
        NTSTATUS status;
 
368
 
408
369
        if (cli_is_nt_error(cli)) {
409
 
                NTSTATUS status = cli_nt_error(cli);
410
 
                return cli_errno_from_nt(status);
 
370
                status = cli_nt_error(cli);
 
371
                return cli_errno_from_nt(status);
411
372
        }
412
373
 
413
374
        if (cli_is_dos_error(cli)) {
415
376
                uint32 ecode;
416
377
 
417
378
                cli_dos_error(cli, &eclass, &ecode);
418
 
                return cli_errno_from_dos(eclass, ecode);
 
379
                status = dos_to_ntstatus(eclass, ecode);
 
380
                return cli_errno_from_nt(status);
419
381
        }
420
382
 
421
383
        /* for other cases */