1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

it now all compiles - so try enabling it by default and see what explodes on the build farm

This commit is contained in:
Andrew Tridgell 0001-01-01 00:00:00 +00:00
parent 90b3dccfd4
commit 5bb7e4f0f6
11 changed files with 330 additions and 354 deletions

View File

@ -213,7 +213,7 @@ typedef struct nttime_info
are mixed up. This is especially important as we slowly convert Samba
from using BOOL for internal functions
*/
#if defined(HAVE_IMMEDIATE_STRUCTURES) && defined(TRIDGE_TEST)
#if defined(HAVE_IMMEDIATE_STRUCTURES)
typedef struct {uint32 v;} NTSTATUS;
#define NT_STATUS(x) ((NTSTATUS) { x })
#define NT_STATUS_V(x) ((x).v)
@ -223,7 +223,7 @@ typedef uint32 NTSTATUS;
#define NT_STATUS_V(x) (x)
#endif
#if defined(HAVE_IMMEDIATE_STRUCTURES) && defined(TRIDGE_TEST)
#if defined(HAVE_IMMEDIATE_STRUCTURES)
typedef struct {uint32 v;} WERROR;
#define W_ERROR(x) ((WERROR) { x })
#define W_ERROR_V(x) ((x).v)

View File

@ -212,8 +212,8 @@ int smbc_errno(struct cli_state *c)
status = cli_nt_error(c);
ret = cli_errno_from_nt(status);
DEBUG(3,("smbc errno 0x%08x -> %d\n",
status, ret));
DEBUG(3,("smbc errno %s -> %d\n",
get_nt_error_msg(status), ret));
}
return ret;

View File

@ -66,7 +66,7 @@ BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int de
if(!prs_align(ps))
return False;
if(!prs_ntstatus("exist flag", ps, 0, &q_d->status))
if(!prs_uint32("exist flag", ps, 0, &q_d->status))
return False;
return True;

View File

@ -2445,8 +2445,8 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
}
prs_align(ps);
if (!prs_uint32("status", ps, depth, &r_s->status))
return False;
if (!prs_ntstatus("status", ps, depth, &(r_s->status)))
return False;
return True;
}
@ -2578,7 +2578,7 @@ BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16],
}
prs_align(ps);
if (!prs_uint32("status", ps, depth, &r_s->status))
if (!prs_ntstatus("status", ps, depth, &r_s->status))
return False;
return True;

View File

@ -27,15 +27,15 @@ extern pstring server;
/* Check DFS is supported by the remote server */
static uint32 cmd_dfs_exist(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_dfs_exist(struct cli_state *cli, int argc, char **argv)
{
TALLOC_CTX *mem_ctx;
BOOL dfs_exists;
uint32 result;
NTSTATUS result;
if (argc != 1) {
printf("Usage: %s\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -53,7 +53,7 @@ static uint32 cmd_dfs_exist(struct cli_state *cli, int argc, char **argv)
result = cli_dfs_exist(cli, mem_ctx, &dfs_exists);
if (result == NT_STATUS_OK)
if (NT_STATUS_IS_OK(result))
printf("dfs is %spresent\n", dfs_exists ? "" : "not ");
cli_nt_session_close(cli);
@ -63,17 +63,17 @@ done:
return result;
}
static uint32 cmd_dfs_add(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_dfs_add(struct cli_state *cli, int argc, char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result;
NTSTATUS result;
char *entrypath, *servername, *sharename, *comment;
uint32 flags = 0;
if (argc != 5) {
printf("Usage: %s entrypath servername sharename comment\n",
argv[0]);
return 0;
return NT_STATUS_OK;
}
entrypath = argv[1];
@ -104,15 +104,15 @@ done:
return result;
}
static uint32 cmd_dfs_remove(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_dfs_remove(struct cli_state *cli, int argc, char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result;
NTSTATUS result;
char *entrypath, *servername, *sharename;
if (argc != 4) {
printf("Usage: %s entrypath servername sharename\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
entrypath = argv[1];
@ -222,15 +222,16 @@ static void display_dfs_info_ctr(DFS_INFO_CTR *ctr)
/* Enumerate dfs shares */
static uint32 cmd_dfs_enum(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_dfs_enum(struct cli_state *cli, int argc, char **argv)
{
TALLOC_CTX *mem_ctx;
DFS_INFO_CTR ctr;
uint32 result, info_level = 1;
NTSTATUS result;
uint32 info_level = 1;
if (argc > 2) {
printf("Usage: %s [info_level]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (argc == 2)
@ -238,7 +239,7 @@ static uint32 cmd_dfs_enum(struct cli_state *cli, int argc, char **argv)
if (!(mem_ctx = talloc_init())) {
DEBUG(0,("cmd_dfs_enum: talloc_init failed\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
/* Initialise RPC connection */
@ -251,9 +252,8 @@ static uint32 cmd_dfs_enum(struct cli_state *cli, int argc, char **argv)
/* Call RPC function */
if ((result = cli_dfs_enum(cli, mem_ctx, info_level, &ctr))
== NT_STATUS_OK) {
result = cli_dfs_enum(cli, mem_ctx, info_level, &ctr);
if (NT_STATUS_IS_OK(result)) {
/* Print results */
display_dfs_info_ctr(&ctr);
}
@ -265,17 +265,17 @@ done:
return result;
}
static uint32 cmd_dfs_getinfo(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_dfs_getinfo(struct cli_state *cli, int argc, char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result;
NTSTATUS result;
char *entrypath, *servername, *sharename;
uint32 info_level = 1;
DFS_INFO_CTR ctr;
if (argc < 4 || argc > 5) {
printf("Usage: %s entrypath servername sharename [info_level]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
entrypath = argv[1];
@ -300,12 +300,10 @@ static uint32 cmd_dfs_getinfo(struct cli_state *cli, int argc, char **argv)
/* Call RPC function */
if ((result = cli_dfs_get_info(cli, mem_ctx, entrypath, servername,
sharename, info_level, &ctr))
== NT_STATUS_OK) {
result = cli_dfs_get_info(cli, mem_ctx, entrypath, servername,
sharename, info_level, &ctr);
if (NT_STATUS_IS_OK(result)) {
/* Print results */
display_dfs_info_ctr(&ctr);
}

View File

@ -24,16 +24,16 @@
extern int DEBUGLEVEL;
static uint32 cmd_netlogon_logon_ctrl2(struct cli_state *cli, int argc,
static NTSTATUS cmd_netlogon_logon_ctrl2(struct cli_state *cli, int argc,
char **argv)
{
uint32 query_level = 1;
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (argc > 1) {
printf("Usage: %s\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -48,8 +48,8 @@ static uint32 cmd_netlogon_logon_ctrl2(struct cli_state *cli, int argc,
goto done;
}
if ((result = cli_netlogon_logon_ctrl2(cli, mem_ctx, query_level))
!= NT_STATUS_OK) {
result = cli_netlogon_logon_ctrl2(cli, mem_ctx, query_level);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -59,18 +59,18 @@ static uint32 cmd_netlogon_logon_ctrl2(struct cli_state *cli, int argc,
return result;
}
static uint32 cmd_netlogon_logon_ctrl(struct cli_state *cli, int argc,
static NTSTATUS cmd_netlogon_logon_ctrl(struct cli_state *cli, int argc,
char **argv)
{
#if 0
uint32 query_level = 1;
#endif
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (argc > 1) {
printf("Usage: %s\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -86,8 +86,8 @@ static uint32 cmd_netlogon_logon_ctrl(struct cli_state *cli, int argc,
}
#if 0
if ((result = cli_netlogon_logon_ctrl(cli, mem_ctx, query_level))
!= NT_STATUS_OK) {
result = cli_netlogon_logon_ctrl(cli, mem_ctx, query_level);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
#endif
@ -169,10 +169,10 @@ static void display_sam_sync(uint32 num_deltas, SAM_DELTA_HDR *hdr_deltas,
/* Perform sam synchronisation */
static uint32 cmd_netlogon_sam_sync(struct cli_state *cli, int argc,
static NTSTATUS cmd_netlogon_sam_sync(struct cli_state *cli, int argc,
char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
unsigned char trust_passwd[16];
TALLOC_CTX *mem_ctx;
uint32 database_id = 0, num_deltas;
@ -181,7 +181,7 @@ static uint32 cmd_netlogon_sam_sync(struct cli_state *cli, int argc,
if (argc > 2) {
printf("Usage: %s [database_id]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (argc == 2)
@ -219,9 +219,9 @@ static uint32 cmd_netlogon_sam_sync(struct cli_state *cli, int argc,
/* Synchronise sam database */
if ((result = cli_netlogon_sam_sync(cli, mem_ctx, database_id,
&num_deltas, &hdr_deltas, &deltas))
!= NT_STATUS_OK) {
result = cli_netlogon_sam_sync(cli, mem_ctx, database_id,
&num_deltas, &hdr_deltas, &deltas);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -238,10 +238,10 @@ static uint32 cmd_netlogon_sam_sync(struct cli_state *cli, int argc,
/* Perform sam delta synchronisation */
static uint32 cmd_netlogon_sam_deltas(struct cli_state *cli, int argc,
static NTSTATUS cmd_netlogon_sam_deltas(struct cli_state *cli, int argc,
char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
unsigned char trust_passwd[16];
TALLOC_CTX *mem_ctx = NULL;
uint32 database_id, num_deltas, tmp;
@ -251,7 +251,7 @@ static uint32 cmd_netlogon_sam_deltas(struct cli_state *cli, int argc,
if (argc != 3) {
printf("Usage: %s database_id seqnum\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
database_id = atoi(argv[1]);
@ -292,10 +292,10 @@ static uint32 cmd_netlogon_sam_deltas(struct cli_state *cli, int argc,
/* Synchronise sam database */
if ((result = cli_netlogon_sam_deltas(cli, mem_ctx, database_id,
seqnum, &num_deltas,
&hdr_deltas, &deltas))
!= NT_STATUS_OK) {
result = cli_netlogon_sam_deltas(cli, mem_ctx, database_id,
seqnum, &num_deltas,
&hdr_deltas, &deltas);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}

View File

@ -906,9 +906,9 @@ static void cmd_reg_get_key_sec(struct client_info *info)
/****************************************************************************
nt registry shutdown
****************************************************************************/
static uint32 cmd_reg_shutdown(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_reg_shutdown(struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
fstring msg;
uint32 timeout = 20;
uint16 flgs = 0;
@ -973,7 +973,7 @@ static uint32 cmd_reg_shutdown(struct cli_state *cli, int argc, char **argv)
/* create an entry */
result = cli_reg_shutdown(cli, mem_ctx, srv_name, msg, timeout, flgs);
if (result == NT_STATUS_OK)
if (NT_STATUS_IS_OK(result))
DEBUG(5,("cmd_reg_shutdown: query succeeded\n"));
else
DEBUG(5,("cmd_reg_shutdown: query failed\n"));
@ -989,9 +989,9 @@ done:
/****************************************************************************
abort a shutdown
****************************************************************************/
static uint32 cmd_reg_abort_shutdown(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_reg_abort_shutdown(struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int ret;
char *srv_name;
TALLOC_CTX *mem_ctx;
@ -1017,7 +1017,7 @@ static uint32 cmd_reg_abort_shutdown(struct cli_state *cli, int argc, char **arg
result = cli_reg_abort_shutdown(cli, mem_ctx, srv_name);
if (result == NT_STATUS_OK)
if (NT_STATUS_IS_OK(result))
DEBUG(5,("cmd_reg_abort_shutdown: query succeeded\n"));
else
DEBUG(5,("cmd_reg_abort_shutdown: query failed\n"));

View File

@ -138,7 +138,7 @@ void display_sam_info_1(SAM_ENTRY1 *e1, SAM_STR1 *s1)
/**********************************************************************
* Query user information
*/
static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND connect_pol, domain_pol, user_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
@ -154,7 +154,7 @@ static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
if (argc != 2) {
printf("Usage: %s rid\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
sscanf(argv[1], "%i", &user_rid);
@ -177,27 +177,27 @@ static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
strupper (server);
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_domain_pol = True;
if ((result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rid, &user_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rid, &user_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -205,9 +205,9 @@ static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
ZERO_STRUCT(user_ctr);
if ((result = cli_samr_query_userinfo(cli, mem_ctx, &user_pol,
info_level, &user_ctr))
!= NT_STATUS_OK) {
result = cli_samr_query_userinfo(cli, mem_ctx, &user_pol,
info_level, &user_ctr);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -270,10 +270,11 @@ static void display_group_info_ctr(GROUP_INFO_CTR *ctr)
/***********************************************************************
* Query group information
*/
static uint32 cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND connect_pol, domain_pol, group_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL, info_level = 1;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 info_level = 1;
BOOL got_connect_pol = False, got_domain_pol = False,
got_group_pol = False;
GROUP_INFO_CTR group_ctr;
@ -283,7 +284,7 @@ static uint32 cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
if (argc != 2) {
printf("Usage: %s rid\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
group_rid = atoi(argv[1]);
@ -305,27 +306,27 @@ static uint32 cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
strupper (server);
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_domain_pol = True;
if ((result = cli_samr_open_group(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
group_rid, &group_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_group(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
group_rid, &group_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -333,9 +334,9 @@ static uint32 cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
ZERO_STRUCT(group_ctr);
if ((result = cli_samr_query_groupinfo(cli, mem_ctx, &group_pol,
info_level, &group_ctr))
!= NT_STATUS_OK) {
result = cli_samr_query_groupinfo(cli, mem_ctx, &group_pol,
info_level, &group_ctr);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -354,12 +355,12 @@ done:
/* Query groups a user is a member of */
static uint32 cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND connect_pol,
domain_pol,
user_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False,
got_domain_pol = False,
got_user_pol = False;
@ -372,13 +373,13 @@ static uint32 cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **
if (argc != 2) {
printf("Usage: %s rid\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_samr_query_usergroups: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
sscanf(argv[1], "%i", &user_rid);
@ -395,35 +396,35 @@ static uint32 cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **
slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
strupper (server);
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_domain_pol = True;
if ((result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rid, &user_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rid, &user_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_user_pol = True;
if ((result = cli_samr_query_usergroups(cli, mem_ctx, &user_pol,
&num_groups, &user_gids))
!= NT_STATUS_OK) {
result = cli_samr_query_usergroups(cli, mem_ctx, &user_pol,
&num_groups, &user_gids);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -445,10 +446,10 @@ static uint32 cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **
/* Query members of a group */
static uint32 cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND connect_pol, domain_pol, group_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False,
got_domain_pol = False,
got_group_pol = False;
@ -459,13 +460,13 @@ static uint32 cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **ar
if (argc != 2) {
printf("Usage: %s rid\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_samr_query_groupmem: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
sscanf(argv[1], "%i", &group_rid);
@ -482,36 +483,36 @@ static uint32 cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **ar
slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
strupper (server);
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_domain_pol = True;
if ((result = cli_samr_open_group(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
group_rid, &group_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_group(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
group_rid, &group_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_group_pol = True;
if ((result = cli_samr_query_groupmem(cli, mem_ctx, &group_pol,
&num_members, &group_rids,
&group_attrs))
!= NT_STATUS_OK) {
result = cli_samr_query_groupmem(cli, mem_ctx, &group_pol,
&num_members, &group_rids,
&group_attrs);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -533,11 +534,11 @@ static uint32 cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **ar
/* Enumerate domain groups */
static uint32 cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
static NTSTATUS cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
char **argv)
{
POLICY_HND connect_pol, domain_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False, got_domain_pol = False;
TALLOC_CTX *mem_ctx;
uint32 start_idx, size, num_dom_groups, i;
@ -545,7 +546,7 @@ static uint32 cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
if (argc != 1) {
printf("Usage: %s\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -566,9 +567,9 @@ static uint32 cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
/* Get sam policy handle */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -576,10 +577,10 @@ static uint32 cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
/* Get domain policy handle */
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -610,19 +611,20 @@ static uint32 cmd_samr_enum_dom_groups(struct cli_state *cli, int argc,
/* Query alias membership */
static uint32 cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
static NTSTATUS cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
char **argv)
{
POLICY_HND connect_pol, domain_pol, alias_pol;
BOOL got_connect_pol = False, got_domain_pol = False,
got_alias_pol = False;
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL, alias_rid, num_members, i;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 alias_rid, num_members, i;
DOM_SID *alias_sids;
if (argc != 2) {
printf("Usage: %s rid\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx=talloc_init())) {
@ -645,9 +647,9 @@ static uint32 cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
/* Open SAMR handle */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol)) !=
NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -655,10 +657,10 @@ static uint32 cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
/* Open handle on domain */
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -666,18 +668,18 @@ static uint32 cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
/* Open handle on alias */
if ((result = cli_samr_open_alias(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
alias_rid, &alias_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_alias(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
alias_rid, &alias_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_alias_pol = True;
if ((result = cli_samr_query_aliasmem(cli, mem_ctx, &alias_pol,
&num_members, &alias_sids))
!= NT_STATUS_OK) {
result = cli_samr_query_aliasmem(cli, mem_ctx, &alias_pol,
&num_members, &alias_sids);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -701,11 +703,11 @@ static uint32 cmd_samr_query_aliasmem(struct cli_state *cli, int argc,
/* Query display info */
static uint32 cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
char **argv)
static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
char **argv)
{
POLICY_HND connect_pol, domain_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False, got_domain_pol = False;
TALLOC_CTX *mem_ctx;
uint32 start_idx, max_entries, num_entries, i;
@ -715,13 +717,13 @@ static uint32 cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
if (argc != 1) {
printf("Usage: %s\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
DEBUG(0, ("cmd_samr_query_dispinfo: talloc_init returned "
"NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
fetch_domain_sid(cli);
@ -736,9 +738,9 @@ static uint32 cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
/* Get sam policy handle */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -746,10 +748,10 @@ static uint32 cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
/* Get domain policy handle */
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -786,11 +788,11 @@ static uint32 cmd_samr_query_dispinfo(struct cli_state *cli, int argc,
/* Query domain info */
static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
char **argv)
static NTSTATUS cmd_samr_query_dominfo(struct cli_state *cli, int argc,
char **argv)
{
POLICY_HND connect_pol, domain_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False, got_domain_pol = False;
TALLOC_CTX *mem_ctx;
uint16 switch_value = 2;
@ -798,7 +800,7 @@ static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (argc == 2)
@ -822,9 +824,9 @@ static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
/* Get sam policy handle */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -832,10 +834,10 @@ static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
/* Get domain policy handle */
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -843,9 +845,9 @@ static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
/* Query domain info */
if ((result = cli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
switch_value, &ctr))
!= NT_STATUS_OK) {
result = cli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
switch_value, &ctr);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -873,11 +875,11 @@ static uint32 cmd_samr_query_dominfo(struct cli_state *cli, int argc,
/* Create domain user */
static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
char **argv)
static NTSTATUS cmd_samr_create_dom_user(struct cli_state *cli, int argc,
char **argv)
{
POLICY_HND connect_pol, domain_pol, user_pol;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
BOOL got_connect_pol = False, got_domain_pol = False,
got_user_pol = False;
TALLOC_CTX *mem_ctx;
@ -887,7 +889,7 @@ static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
if (argc != 2) {
printf("Usage: %s username\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
acct_name = argv[1];
@ -910,9 +912,9 @@ static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
/* Get sam policy handle */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -920,10 +922,10 @@ static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
/* Get domain policy handle */
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -934,10 +936,10 @@ static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
acb_info = ACB_NORMAL;
unknown = 0xe005000b; /* No idea what this is - a permission mask? */
if ((result = cli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
acct_name, acb_info, unknown,
&user_pol, &user_rid))
!= NT_STATUS_OK) {
result = cli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
acct_name, acb_info, unknown,
&user_pol, &user_rid);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -956,11 +958,11 @@ static uint32 cmd_samr_create_dom_user(struct cli_state *cli, int argc,
/* Lookup sam names */
static uint32 cmd_samr_lookup_names(struct cli_state *cli, int argc,
static NTSTATUS cmd_samr_lookup_names(struct cli_state *cli, int argc,
char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
POLICY_HND connect_pol, domain_pol;
BOOL got_connect_pol = False, got_domain_pol = False;
uint32 flags = 0x000003e8;
@ -970,7 +972,7 @@ static uint32 cmd_samr_lookup_names(struct cli_state *cli, int argc,
if (argc < 2) {
printf("Usage: %s name1 [name2 [name3] [...]]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -990,18 +992,18 @@ static uint32 cmd_samr_lookup_names(struct cli_state *cli, int argc,
/* Get sam policy and domain handles */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1015,10 +1017,10 @@ static uint32 cmd_samr_lookup_names(struct cli_state *cli, int argc,
for (i = 0; i < argc - 1; i++)
names[i] = argv[i + 1];
if ((result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
flags, num_names, names,
&num_rids, &rids, &name_types))
!= NT_STATUS_OK) {
result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
flags, num_names, names,
&num_rids, &rids, &name_types);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1040,11 +1042,11 @@ static uint32 cmd_samr_lookup_names(struct cli_state *cli, int argc,
/* Lookup sam rids */
static uint32 cmd_samr_lookup_rids(struct cli_state *cli, int argc,
static NTSTATUS cmd_samr_lookup_rids(struct cli_state *cli, int argc,
char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
POLICY_HND connect_pol, domain_pol;
BOOL got_connect_pol = False, got_domain_pol = False;
uint32 flags = 0x000003e8;
@ -1054,7 +1056,7 @@ static uint32 cmd_samr_lookup_rids(struct cli_state *cli, int argc,
if (argc < 2) {
printf("Usage: %s rid1 [rid2 [rid3] [...]]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -1074,18 +1076,18 @@ static uint32 cmd_samr_lookup_rids(struct cli_state *cli, int argc,
/* Get sam policy and domain handles */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
got_connect_pol = True;
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1099,10 +1101,10 @@ static uint32 cmd_samr_lookup_rids(struct cli_state *cli, int argc,
for (i = 0; i < argc - 1; i++)
rids[i] = atoi(argv[i + 1]);
if ((result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
flags, num_rids, rids,
&num_names, &names, &name_types))
!= NT_STATUS_OK) {
result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
flags, num_rids, rids,
&num_names, &names, &name_types);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1123,16 +1125,16 @@ static uint32 cmd_samr_lookup_rids(struct cli_state *cli, int argc,
/* Delete domain user */
static uint32 cmd_samr_delete_dom_user(struct cli_state *cli, int argc,
static NTSTATUS cmd_samr_delete_dom_user(struct cli_state *cli, int argc,
char **argv)
{
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
POLICY_HND connect_pol, domain_pol, user_pol;
if (argc != 2) {
printf("Usage: %s username\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (!(mem_ctx = talloc_init())) {
@ -1152,16 +1154,16 @@ static uint32 cmd_samr_delete_dom_user(struct cli_state *cli, int argc,
/* Get sam policy and domain handles */
if ((result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol))
!= NT_STATUS_OK) {
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
if ((result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
MAXIMUM_ALLOWED_ACCESS,
&domain_sid, &domain_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1171,26 +1173,26 @@ static uint32 cmd_samr_delete_dom_user(struct cli_state *cli, int argc,
uint32 *user_rids, num_rids, *name_types;
uint32 flags = 0x000003e8;
if ((result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
flags, 1, &argv[1],
&num_rids, &user_rids,
&name_types))
!= NT_STATUS_OK) {
result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
flags, 1, &argv[1],
&num_rids, &user_rids,
&name_types);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
if ((result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rids[0], &user_pol))
!= NT_STATUS_OK) {
result = cli_samr_open_user(cli, mem_ctx, &domain_pol,
MAXIMUM_ALLOWED_ACCESS,
user_rids[0], &user_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
}
/* Delete user */
if ((result = cli_samr_delete_dom_user(cli, mem_ctx, &user_pol))
!= NT_STATUS_OK) {
result = cli_samr_delete_dom_user(cli, mem_ctx, &user_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}

View File

@ -80,7 +80,7 @@ BOOL get_short_archi(char *short_archi, char *long_archi)
/**********************************************************************
* dummy function -- placeholder
*/
static uint32 cmd_spoolss_not_implemented (struct cli_state *cli,
static NTSTATUS cmd_spoolss_not_implemented (struct cli_state *cli,
int argc, char **argv)
{
printf ("(*) This command is not currently implemented.\n");
@ -142,9 +142,9 @@ static void display_sec_desc(SEC_DESC *sec)
/***********************************************************************
* Get printer information
*/
static uint32 cmd_spoolss_open_printer_ex(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_open_printer_ex(struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
pstring printername;
fstring servername, user;
POLICY_HND hnd;
@ -182,10 +182,10 @@ static uint32 cmd_spoolss_open_printer_ex(struct cli_state *cli, int argc, char
result = cli_spoolss_open_printer_ex (cli, mem_ctx, printername, "",
MAXIMUM_ALLOWED_ACCESS, servername, user, &hnd);
if (result == NT_STATUS_OK) {
if (NT_STATUS_IS_OK(result)) {
printf ("Printer %s opened successfully\n", printername);
result = cli_spoolss_close_printer (cli, mem_ctx, &hnd);
if (result != NT_STATUS_OK) {
if (!NT_STATUS_IS_OK(result)) {
printf ("Error closing printer handle! (%s)\n", get_nt_error_msg(result));
}
}
@ -332,10 +332,10 @@ static void display_print_info_3(PRINTER_INFO_3 *i3)
/* Enumerate printers */
static uint32 cmd_spoolss_enum_printers(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL,
info_level = 1;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 info_level = 1;
PRINTER_INFO_CTR ctr;
int returned;
uint32 i = 0;
@ -371,7 +371,7 @@ static uint32 cmd_spoolss_enum_printers(struct cli_state *cli, int argc, char **
result = cli_spoolss_enum_printers(cli, mem_ctx, PRINTER_ENUM_LOCAL,
info_level, &returned, &ctr);
if (result == NT_STATUS_OK)
if (NT_STATUS_IS_OK(result))
{
if (!returned)
printf ("No Printers printers returned.\n");
@ -442,10 +442,10 @@ static void display_port_info_2(PORT_INFO_2 *i2)
/* Enumerate ports */
static uint32 cmd_spoolss_enum_ports(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_enum_ports(struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL,
info_level = 1;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 info_level = 1;
PORT_INFO_CTR ctr;
int returned;
TALLOC_CTX *mem_ctx;
@ -478,7 +478,7 @@ static uint32 cmd_spoolss_enum_ports(struct cli_state *cli, int argc, char **arg
result = cli_spoolss_enum_ports(cli, mem_ctx, info_level, &returned, &ctr);
if (result == NT_STATUS_OK) {
if (NT_STATUS_IS_OK(result)) {
int i;
for (i = 0; i < returned; i++) {
@ -505,11 +505,11 @@ static uint32 cmd_spoolss_enum_ports(struct cli_state *cli, int argc, char **arg
/***********************************************************************
* Get printer information
*/
static uint32 cmd_spoolss_getprinter(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_getprinter(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
uint32 result,
info_level = 1;
NTSTATUS result;
uint32 info_level = 1;
BOOL opened_hnd = False;
PRINTER_INFO_CTR ctr;
fstring printername,
@ -547,17 +547,18 @@ static uint32 cmd_spoolss_getprinter(struct cli_state *cli, int argc, char **arg
fstrcpy (user, cli->user_name);
/* get a printer handle */
if ((result = cli_spoolss_open_printer_ex(
result = cli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS, servername,
user, &pol)) != NT_STATUS_OK) {
user, &pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
opened_hnd = True;
/* Get printer info */
if ((result = cli_spoolss_getprinter(cli, mem_ctx, &pol, info_level, &ctr))
!= NT_STATUS_OK) {
result = cli_spoolss_getprinter(cli, mem_ctx, &pol, info_level, &ctr);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -704,11 +705,11 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1)
/***********************************************************************
* Get printer information
*/
static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
uint32 result,
info_level = 3;
NTSTATUS result;
uint32 info_level = 3;
BOOL opened_hnd = False;
PRINTER_DRIVER_CTR ctr;
fstring printername,
@ -746,9 +747,9 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
info_level = atoi(argv[2]);
/* Open a printer handle */
if ((result=cli_spoolss_open_printer_ex (cli, mem_ctx, printername, "",
MAXIMUM_ALLOWED_ACCESS, servername, user, &pol)) != NT_STATUS_OK)
{
result=cli_spoolss_open_printer_ex (cli, mem_ctx, printername, "",
MAXIMUM_ALLOWED_ACCESS, servername, user, &pol);
if (!NT_STATUS_IS_OK(result)) {
printf ("Error opening printer handle for %s!\n", printername);
return result;
}
@ -758,20 +759,9 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
/* loop through and print driver info level for each architecture */
for (i=0; archi_table[i].long_archi!=NULL; i++)
{
result = cli_spoolss_getprinterdriver (cli, mem_ctx, &pol, info_level,
archi_table[i].long_archi, &ctr);
switch (result)
{
case NT_STATUS_OK:
break;
case WERR_UNKNOWN_PRINTER_DRIVER:
continue;
default:
printf ("Error getting driver for %s [%s] - %s\n", printername,
archi_table[i].long_archi, get_nt_error_msg(result));
result = cli_spoolss_getprinterdriver(cli, mem_ctx, &pol, info_level,
archi_table[i].long_archi, &ctr);
if (!NT_STATUS_IS_OK(result)) {
continue;
}
@ -793,8 +783,6 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
printf("unknown info level %d\n", info_level);
break;
}
}
@ -804,20 +792,17 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
cli_nt_session_close (cli);
talloc_destroy(mem_ctx);
if (result==WERR_UNKNOWN_PRINTER_DRIVER)
return NT_STATUS_OK;
else
return result;
return result;
}
/***********************************************************************
* Get printer information
*/
static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **argv)
{
uint32 result=0,
info_level = 1;
NTSTATUS result = NT_STATUS_OK;
uint32 info_level = 1;
PRINTER_DRIVER_CTR ctr;
fstring servername;
uint32 i, j,
@ -833,7 +818,7 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_spoolss_enum_drivers: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
/* Initialise RPC connection */
@ -862,7 +847,7 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
continue;
if (result != NT_STATUS_OK)
if (!NT_STATUS_IS_OK(result))
{
printf ("Error getting driver for environment [%s] - %s\n",
archi_table[i].long_archi, get_nt_error_msg(result));
@ -899,11 +884,7 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
cli_nt_session_close (cli);
talloc_destroy(mem_ctx);
if (result==WERR_UNKNOWN_PRINTER_DRIVER)
return NT_STATUS_OK;
else
return result;
return result;
}
/****************************************************************************
@ -923,9 +904,9 @@ static void display_printdriverdir_1(DRIVER_DIRECTORY_1 *i1)
/***********************************************************************
* Get printer driver directory information
*/
static uint32 cmd_spoolss_getdriverdir(struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_getdriverdir(struct cli_state *cli, int argc, char **argv)
{
uint32 result;
NTSTATUS result;
fstring env;
DRIVER_DIRECTORY_CTR ctr;
TALLOC_CTX *mem_ctx;
@ -957,9 +938,8 @@ static uint32 cmd_spoolss_getdriverdir(struct cli_state *cli, int argc, char **a
fstrcpy (env, "Windows NT x86");
/* Get the directory. Only use Info level 1 */
if ((result = cli_spoolss_getprinterdriverdir (cli, mem_ctx, 1, env, &ctr))
!= NT_STATUS_OK)
{
result = cli_spoolss_getprinterdriverdir (cli, mem_ctx, 1, env, &ctr);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
@ -1082,10 +1062,10 @@ static BOOL init_drv_info_3_members (
}
static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, char **argv)
{
uint32 result,
level = 3;
NTSTATUS result;
uint32 level = 3;
PRINTER_DRIVER_CTR ctr;
DRIVER_INFO_3 info3;
fstring arch;
@ -1106,7 +1086,7 @@ static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, cha
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_spoolss_addprinterdriver: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
/* Initialise RPC connection */
@ -1136,9 +1116,8 @@ static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, cha
ctr.info3 = &info3;
if ((result = cli_spoolss_addprinterdriver (cli, mem_ctx, level, &ctr))
!= NT_STATUS_OK)
{
result = cli_spoolss_addprinterdriver (cli, mem_ctx, level, &ctr);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
@ -1154,10 +1133,10 @@ static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, cha
}
static uint32 cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **argv)
{
uint32 result,
level = 2;
NTSTATUS result;
uint32 level = 2;
PRINTER_INFO_CTR ctr;
PRINTER_INFO_2 info2;
fstring servername;
@ -1173,7 +1152,7 @@ static uint32 cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_spoolss_addprinterex: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
@ -1218,9 +1197,8 @@ static uint32 cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **
*/
ctr.printers_2 = &info2;
if ((result = cli_spoolss_addprinterex (cli, mem_ctx, level, &ctr))
!= NT_STATUS_OK)
{
result = cli_spoolss_addprinterex (cli, mem_ctx, level, &ctr);
if (!NT_STATUS_IS_OK(result)) {
cli_nt_session_close (cli);
return result;
}
@ -1235,11 +1213,11 @@ static uint32 cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **
}
static uint32 cmd_spoolss_setdriver (struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_setdriver (struct cli_state *cli, int argc, char **argv)
{
POLICY_HND pol;
uint32 result,
level = 2;
NTSTATUS result;
uint32 level = 2;
BOOL opened_hnd = False;
PRINTER_INFO_CTR ctr;
PRINTER_INFO_2 info2;
@ -1258,7 +1236,7 @@ static uint32 cmd_spoolss_setdriver (struct cli_state *cli, int argc, char **arg
if (!(mem_ctx=talloc_init()))
{
DEBUG(0,("cmd_spoolss_setdriver: talloc_init returned NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_NO_MEMORY;
}
slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost);
@ -1276,10 +1254,9 @@ static uint32 cmd_spoolss_setdriver (struct cli_state *cli, int argc, char **arg
/* get a printer handle */
if ((result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
MAXIMUM_ALLOWED_ACCESS, servername, user, &pol))
!= NT_STATUS_OK)
{
result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
MAXIMUM_ALLOWED_ACCESS, servername, user, &pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@ -1288,16 +1265,16 @@ static uint32 cmd_spoolss_setdriver (struct cli_state *cli, int argc, char **arg
/* Get printer info */
ZERO_STRUCT (info2);
ctr.printers_2 = &info2;
if ((result = cli_spoolss_getprinter(cli, mem_ctx, &pol, level, &ctr)) != NT_STATUS_OK)
{
result = cli_spoolss_getprinter(cli, mem_ctx, &pol, level, &ctr);
if (!NT_STATUS_IS_OK(result)) {
printf ("Unable to retrieve printer information!\n");
goto done;
}
/* set the printer driver */
init_unistr(&ctr.printers_2->drivername, argv[2]);
if ((result = cli_spoolss_setprinter(cli, mem_ctx, &pol, level, &ctr, 0)) != NT_STATUS_OK)
{
result = cli_spoolss_setprinter(cli, mem_ctx, &pol, level, &ctr, 0);
if (!NT_STATUS_IS_OK(result)) {
printf ("SetPrinter call failed!\n");
goto done;;
}
@ -1315,9 +1292,9 @@ done:
}
static uint32 cmd_spoolss_deletedriver (struct cli_state *cli, int argc, char **argv)
static NTSTATUS cmd_spoolss_deletedriver (struct cli_state *cli, int argc, char **argv)
{
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
fstring servername;
TALLOC_CTX *mem_ctx = NULL;
int i;
@ -1350,9 +1327,9 @@ static uint32 cmd_spoolss_deletedriver (struct cli_state *cli, int argc, char **
for (i=0; archi_table[i].long_archi; i++)
{
/* make the call to remove the driver */
if ((result = cli_spoolss_deleteprinterdriver(cli, mem_ctx,
archi_table[i].long_archi, argv[1])) != NT_STATUS_OK)
{
result = cli_spoolss_deleteprinterdriver(cli, mem_ctx,
archi_table[i].long_archi, argv[1]);
if (!NT_STATUS_IS_OK(result)) {
printf ("Failed to remove driver %s for arch [%s] - error %s!\n",
argv[1], archi_table[i].long_archi, get_nt_error_msg(result));
}

View File

@ -182,17 +182,17 @@ static void display_srv_info_102(SRV_INFO_102 *sv102)
/* Server query info */
static uint32 cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
char **argv)
{
uint32 info_level = 101;
SRV_INFO_CTR ctr;
TALLOC_CTX *mem_ctx;
uint32 result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
return 0;
return NT_STATUS_OK;
}
if (argc == 2)
@ -210,9 +210,9 @@ static uint32 cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
goto done;
}
if ((result = cli_srvsvc_net_srv_get_info(cli, mem_ctx, info_level,
&ctr)
!= NT_STATUS_OK)) {
result = cli_srvsvc_net_srv_get_info(cli, mem_ctx, info_level,
&ctr);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}

View File

@ -92,9 +92,8 @@ static BOOL cacls_open_policy_hnd(void)
/* Some systems don't support SEC_RIGHTS_MAXIMUM_ALLOWED,
but NT sends 0x2000000 so we might as well do it too. */
if (cli_lsa_open_policy(&lsa_cli, lsa_cli.mem_ctx, True,
GENERIC_EXECUTE_ACCESS, &pol)
!= NT_STATUS_OK) {
if (!NT_STATUS_IS_OK(cli_lsa_open_policy(&lsa_cli, lsa_cli.mem_ctx, True,
GENERIC_EXECUTE_ACCESS, &pol))) {
return False;
}
@ -118,8 +117,8 @@ static void SidToString(fstring str, DOM_SID *sid)
/* Ask LSA to convert the sid to a name */
if (!cacls_open_policy_hnd() ||
cli_lsa_lookup_sids(&lsa_cli, lsa_cli.mem_ctx, &pol, 1, sid, &names, &types,
&num_names) != NT_STATUS_OK ||
!NT_STATUS_IS_OK(cli_lsa_lookup_sids(&lsa_cli, lsa_cli.mem_ctx, &pol, 1, sid, &names,
&types, &num_names)) ||
!names || !names[0]) {
return;
}
@ -142,8 +141,8 @@ static BOOL StringToSid(DOM_SID *sid, char *str)
}
if (!cacls_open_policy_hnd() ||
cli_lsa_lookup_names(&lsa_cli, lsa_cli.mem_ctx, &pol, 1, &str, &sids, &types,
&num_sids) != NT_STATUS_OK) {
!NT_STATUS_IS_OK(cli_lsa_lookup_names(&lsa_cli, lsa_cli.mem_ctx, &pol, 1, &str,
&sids, &types, &num_sids))) {
result = False;
goto done;
}