mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Fixed a bunch of crash bugs for enumprinters at various info levels.
(This used to be commit d9df00e2b1
)
This commit is contained in:
parent
11c0e88d9e
commit
6fbd44c77a
@ -134,6 +134,9 @@ static void display_print_info_0(PRINTER_INFO_0 *i0)
|
|||||||
fstring name = "";
|
fstring name = "";
|
||||||
fstring servername = "";
|
fstring servername = "";
|
||||||
|
|
||||||
|
if (!i0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (i0->printername.buffer)
|
if (i0->printername.buffer)
|
||||||
rpcstr_pull(name, i0->printername.buffer, sizeof(name), 0, STR_TERMINATE);
|
rpcstr_pull(name, i0->printername.buffer, sizeof(name), 0, STR_TERMINATE);
|
||||||
|
|
||||||
@ -179,6 +182,8 @@ static void display_print_info_0(PRINTER_INFO_0 *i0)
|
|||||||
printf("\tunknown27:[0x%x]\n", i0->unknown27);
|
printf("\tunknown27:[0x%x]\n", i0->unknown27);
|
||||||
printf("\tunknown28:[0x%x]\n", i0->unknown28);
|
printf("\tunknown28:[0x%x]\n", i0->unknown28);
|
||||||
printf("\tunknown29:[0x%x]\n", i0->unknown29);
|
printf("\tunknown29:[0x%x]\n", i0->unknown29);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -205,7 +210,9 @@ static void display_print_info_1(PRINTER_INFO_1 *i1)
|
|||||||
printf("\tflags:[0x%x]\n", i1->flags);
|
printf("\tflags:[0x%x]\n", i1->flags);
|
||||||
printf("\tname:[%s]\n", name);
|
printf("\tname:[%s]\n", name);
|
||||||
printf("\tdescription:[%s]\n", desc);
|
printf("\tdescription:[%s]\n", desc);
|
||||||
printf("\tcomment:[%s]\n\n", comm);
|
printf("\tcomment:[%s]\n", comm);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -278,7 +285,10 @@ static void display_print_info_2(PRINTER_INFO_2 *i2)
|
|||||||
printf("\tcjobs:[0x%x]\n", i2->cjobs);
|
printf("\tcjobs:[0x%x]\n", i2->cjobs);
|
||||||
printf("\taverageppm:[0x%x]\n", i2->averageppm);
|
printf("\taverageppm:[0x%x]\n", i2->averageppm);
|
||||||
|
|
||||||
if (i2->secdesc) display_sec_desc(i2->secdesc);
|
if (i2->secdesc)
|
||||||
|
display_sec_desc(i2->secdesc);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -289,6 +299,8 @@ static void display_print_info_3(PRINTER_INFO_3 *i3)
|
|||||||
printf("\tflags:[0x%x]\n", i3->flags);
|
printf("\tflags:[0x%x]\n", i3->flags);
|
||||||
|
|
||||||
display_sec_desc(i3->secdesc);
|
display_sec_desc(i3->secdesc);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enumerate printers */
|
/* Enumerate printers */
|
||||||
@ -330,28 +342,27 @@ static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
|
|||||||
if (!num_printers)
|
if (!num_printers)
|
||||||
printf ("No Printers printers returned.\n");
|
printf ("No Printers printers returned.\n");
|
||||||
|
|
||||||
|
for (i = 0; i < num_printers; i++) {
|
||||||
switch(info_level) {
|
switch(info_level) {
|
||||||
case 0:
|
case 0:
|
||||||
for (i=0; i < num_printers; i++)
|
|
||||||
display_print_info_0(&ctr.printers_0[i]);
|
display_print_info_0(&ctr.printers_0[i]);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (i=0; i < num_printers; i++)
|
|
||||||
display_print_info_1(&ctr.printers_1[i]);
|
display_print_info_1(&ctr.printers_1[i]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for (i=0; i < num_printers; i++)
|
|
||||||
display_print_info_2(&ctr.printers_2[i]);
|
display_print_info_2(&ctr.printers_2[i]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
for (i=0; i < num_printers; i++)
|
|
||||||
display_print_info_3(&ctr.printers_3[i]);
|
display_print_info_3(&ctr.printers_3[i]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("unknown info level %d\n", info_level);
|
printf("unknown info level %d\n", info_level);
|
||||||
break;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
|
}
|
||||||
|
|
||||||
return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
@ -1451,7 +1462,7 @@ static NTSTATUS cmd_spoolss_deleteform(struct cli_state *cli,
|
|||||||
|
|
||||||
/* Enumerate forms */
|
/* Enumerate forms */
|
||||||
|
|
||||||
static NTSTATUS cmd_spoolss_enumforms(struct cli_state *cli,
|
static NTSTATUS cmd_spoolss_enum_forms(struct cli_state *cli,
|
||||||
TALLOC_CTX *mem_ctx, int argc,
|
TALLOC_CTX *mem_ctx, int argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
@ -1543,7 +1554,7 @@ struct cmd_set spoolss_commands[] = {
|
|||||||
{ "setform", cmd_spoolss_setform, PIPE_SPOOLSS, "Set form", "" },
|
{ "setform", cmd_spoolss_setform, PIPE_SPOOLSS, "Set form", "" },
|
||||||
{ "getform", cmd_spoolss_getform, PIPE_SPOOLSS, "Get form", "" },
|
{ "getform", cmd_spoolss_getform, PIPE_SPOOLSS, "Get form", "" },
|
||||||
{ "deleteform", cmd_spoolss_deleteform, PIPE_SPOOLSS, "Delete form", "" },
|
{ "deleteform", cmd_spoolss_deleteform, PIPE_SPOOLSS, "Delete form", "" },
|
||||||
{ "enumforms", cmd_spoolss_enumforms, PIPE_SPOOLSS, "Enumerate forms", "" },
|
{ "enumforms", cmd_spoolss_enum_forms, PIPE_SPOOLSS, "Enumerate forms", "" },
|
||||||
|
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
@ -122,22 +122,22 @@ void display_sec_desc(SEC_DESC *sec)
|
|||||||
{
|
{
|
||||||
fstring sid_str;
|
fstring sid_str;
|
||||||
|
|
||||||
if (sec->off_sacl != 0) {
|
if (sec->sacl) {
|
||||||
printf("S-ACL\n");
|
printf("SACL\n");
|
||||||
display_sec_acl(sec->sacl);
|
display_sec_acl(sec->sacl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec->off_dacl != 0) {
|
if (sec->dacl) {
|
||||||
printf("D-ACL\n");
|
printf("DACL\n");
|
||||||
display_sec_acl(sec->dacl);
|
display_sec_acl(sec->dacl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec->off_owner_sid != 0) {
|
if (sec->owner_sid) {
|
||||||
sid_to_string(sid_str, sec->owner_sid);
|
sid_to_string(sid_str, sec->owner_sid);
|
||||||
printf("\tOwner SID:\t%s\n", sid_str);
|
printf("\tOwner SID:\t%s\n", sid_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec->off_grp_sid != 0) {
|
if (sec->grp_sid) {
|
||||||
sid_to_string(sid_str, sec->grp_sid);
|
sid_to_string(sid_str, sec->grp_sid);
|
||||||
printf("\tParent SID:\t%s\n", sid_str);
|
printf("\tParent SID:\t%s\n", sid_str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user