~veger/ubuntu/precise/samba/fix-for-902339

« back to all changes in this revision

Viewing changes to source3/libsmb/clirap2.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
/*****************************************************/
77
77
 
78
78
#include "includes.h"
 
79
#include "libsmb/libsmb.h"
 
80
#include "../librpc/gen_ndr/rap.h"
 
81
#include "../librpc/gen_ndr/svcctl.h"
 
82
#include "libsmb/clirap.h"
79
83
 
80
84
#define WORDSIZE 2
81
85
#define DWORDSIZE 4
284
288
 call a NetGroupAdd - add user group to remote server
285
289
****************************************************************************/
286
290
 
287
 
int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo)
 
291
int cli_NetGroupAdd(struct cli_state *cli, struct rap_group_info_1 *grinfo)
288
292
{
289
293
        char *rparam = NULL;
290
294
        char *rdata = NULL;
320
324
        PUTWORD(p, 0); /* reserved word 0 */
321
325
 
322
326
        p = data;
323
 
        PUTSTRINGF(p, grinfo->group_name, RAP_GROUPNAME_LEN);
 
327
        PUTSTRINGF(p, (const char *)grinfo->group_name, RAP_GROUPNAME_LEN);
324
328
        PUTBYTE(p, 0); /* pad byte 0 */
325
329
        PUTSTRINGP(p, grinfo->comment, data, soffset);
326
330
 
830
834
 Call a NetUserAdd - add user to remote server.
831
835
****************************************************************************/
832
836
 
833
 
int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
 
837
int cli_NetUserAdd(struct cli_state *cli, struct rap_user_info_1 * userinfo )
834
838
{
835
839
        char *rparam = NULL;
836
840
        char *rdata = NULL;
863
867
        PUTWORD(p, 1); /* info level */
864
868
        PUTWORD(p, 0); /* pwencrypt */
865
869
        if(userinfo->passwrd)
866
 
                PUTWORD(p,MIN(strlen(userinfo->passwrd), RAP_UPASSWD_LEN));
 
870
                PUTWORD(p,MIN(strlen((const char *)userinfo->passwrd), RAP_UPASSWD_LEN));
867
871
        else
868
872
                PUTWORD(p, 0); /* password length */
869
873
 
870
874
        p = data;
871
875
        memset(data, '\0', soffset);
872
876
 
873
 
        PUTSTRINGF(p, userinfo->user_name, RAP_USERNAME_LEN);
 
877
        PUTSTRINGF(p, (const char *)userinfo->user_name, RAP_USERNAME_LEN);
874
878
        PUTBYTE(p, 0); /* pad byte 0 */
875
 
        PUTSTRINGF(p, userinfo->passwrd, RAP_UPASSWD_LEN);
 
879
        PUTSTRINGF(p, (const char *)userinfo->passwrd, RAP_UPASSWD_LEN);
876
880
        PUTDWORD(p, 0); /* pw age - n.a. on user add */
877
881
        PUTWORD(p, userinfo->priv);
878
882
        PUTSTRINGP(p, userinfo->home_dir, data, soffset);
1333
1337
 Call a NetShareAdd - share/export directory on remote server.
1334
1338
****************************************************************************/
1335
1339
 
1336
 
int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo )
 
1340
int cli_NetShareAdd(struct cli_state *cli, struct rap_share_info_2 * sinfo )
1337
1341
{
1338
1342
        char *rparam = NULL;
1339
1343
        char *rdata = NULL;
1365
1369
        PUTWORD(p, 0); /* reserved word 0 */
1366
1370
 
1367
1371
        p = data;
1368
 
        PUTSTRINGF(p, sinfo->share_name, RAP_SHARENAME_LEN);
 
1372
        PUTSTRINGF(p, (const char *)sinfo->share_name, RAP_SHARENAME_LEN);
1369
1373
        PUTBYTE(p, 0); /* pad byte 0 */
1370
1374
 
1371
1375
        PUTWORD(p, sinfo->share_type);
1374
1378
        PUTWORD(p, sinfo->maximum_users);
1375
1379
        PUTWORD(p, sinfo->active_users);
1376
1380
        PUTSTRINGP(p, sinfo->path, data, soffset);
1377
 
        PUTSTRINGF(p, sinfo->password, RAP_SPASSWD_LEN);
 
1381
        PUTSTRINGF(p, (const char *)sinfo->password, RAP_SPASSWD_LEN);
1378
1382
        SCVAL(p,-1,0x0A); /* required 0x0A at end of password */
1379
1383
 
1380
1384
        if (cli_api(cli,
1899
1903
 
1900
1904
int cli_NetPrintQEnum(struct cli_state *cli,
1901
1905
                void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
1902
 
                void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*))
 
1906
                void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*))
1903
1907
{
1904
1908
        char param[WORDSIZE                         /* api number    */
1905
1909
                +sizeof(RAP_NetPrintQEnum_REQ)    /* req string    */
2075
2079
 
2076
2080
int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
2077
2081
        void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2078
 
        void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*))
 
2082
        void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*))
2079
2083
{
2080
2084
        char param[WORDSIZE                         /* api number    */
2081
2085
                +sizeof(RAP_NetPrintQGetInfo_REQ) /* req string    */
2335
2339
 Call a NetSessionEnum - list workstations with sessions to an SMB server.
2336
2340
****************************************************************************/
2337
2341
 
2338
 
int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, char *))
 
2342
int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, char *))
2339
2343
{
2340
2344
        char param[WORDSIZE                       /* api number    */
2341
2345
                +sizeof(RAP_NetSessionEnum_REQ) /* parm string   */
2435
2439
****************************************************************************/
2436
2440
 
2437
2441
int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
2438
 
                void (*fn)(const char *, const char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, const char *))
 
2442
                void (*fn)(const char *, const char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, const char *))
2439
2443
{
2440
2444
        char param[WORDSIZE                          /* api number    */
2441
2445
                +sizeof(RAP_NetSessionGetInfo_REQ) /* req string    */