1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

testing for attempts to get more info levels into samr_query_userinfo

This commit is contained in:
Luke Leighton -
parent 25025f4505
commit cc19d5cc5c
4 changed files with 60 additions and 12 deletions

View File

@ -558,6 +558,12 @@ void reset_globals_after_fork(void);
char *client_name(int fd);
char *client_addr(int fd);
/*The following definitions come from lib/util_status.c */
BOOL get_connection_status(struct connect_record **crec,
uint32 *connection_count);
BOOL get_session_count(struct connect_record **srec,uint32 *session_count);
/*The following definitions come from lib/util_str.c */
void set_first_token(char *ptr);
@ -1854,7 +1860,7 @@ BOOL get_samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 user_rid, SAM_USER_INFO_21 *usr);
uint32 user_rid, void *usr);
BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
@ -2668,7 +2674,7 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr,
uint32 rid_group,
uint16 acct_ctrl);
void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth);
void make_sam_user_info_24(SAM_USER_INFO_24 *usr,
void make_sam_user_info24(SAM_USER_INFO_24 *usr,
char newpass[516]);
void make_sam_user_info23(SAM_USER_INFO_23 *usr,

View File

@ -1166,6 +1166,8 @@ typedef struct r_samr_query_user_info
SAM_USER_INFO_10 *id10; /* auth-level 0x10 */
SAM_USER_INFO_11 *id11; /* auth-level 0x11 */
SAM_USER_INFO_21 *id21; /* auth-level 21 */
SAM_USER_INFO_23 *id23; /* auth-level 0x17 */
SAM_USER_INFO_24 *id24; /* auth-level 0x18 */
void* id; /* to make typecasting easy */
} info;

View File

@ -309,14 +309,12 @@ do a SAMR query user info
BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 user_rid, SAM_USER_INFO_21 *usr)
uint32 user_rid, void *usr)
{
POLICY_HND pol_open_user;
BOOL ret = True;
if (pol_open_domain == NULL || usr == NULL) return False;
bzero(usr, sizeof(*usr));
if (pol_open_domain == NULL) return False;
/* send open domain (on user sid) */
if (!samr_open_user(cli, fnum,
@ -330,7 +328,7 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
/* send user info query */
if (!samr_query_userinfo(cli, fnum,
&pol_open_user,
info_level, (void*)usr))
info_level, usr))
{
DEBUG(5,("samr_query_userinfo: error in query user info, level 0x%x\n",
info_level));
@ -2329,7 +2327,7 @@ BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
DEBUG(4,("SAMR Query User Info. level: %d\n", switch_value));
if (pol == NULL || usr == NULL || switch_value == 0) return False;
if (pol == NULL || switch_value == 0) return False;
/* create and send a MSRPC command with api SAMR_QUERY_USERINFO */

View File

@ -4146,7 +4146,7 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int
unknown_6 = 0x0000 04ec
*************************************************************************/
void make_sam_user_info_24(SAM_USER_INFO_24 *usr,
void make_sam_user_info24(SAM_USER_INFO_24 *usr,
char newpass[516])
{
memcpy(usr->pass, newpass, sizeof(usr->pass));
@ -4155,7 +4155,7 @@ void make_sam_user_info_24(SAM_USER_INFO_24 *usr,
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void sam_io_user_info_24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth)
static void sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth)
{
if (usr == NULL) return;
@ -4569,6 +4569,22 @@ void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u,
break;
}
case 23:
{
r_u->ptr = 1;
r_u->info.id23 = (SAM_USER_INFO_23*)info;
break;
}
case 24:
{
r_u->ptr = 1;
r_u->info.id24 = (SAM_USER_INFO_24*)info;
break;
}
default:
{
DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n"));
@ -4596,7 +4612,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc
prs_uint16("switch_value", ps, depth, &(r_u->switch_value));
prs_align(ps);
if (r_u->ptr != 0 && r_u->switch_value != 0)
if (r_u->ptr != 0 && r_u->switch_value != 0 && r_u->info.id != NULL)
{
switch (r_u->switch_value)
{
@ -4641,6 +4657,32 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc
}
break;
}
case 23:
{
if (r_u->info.id23 != NULL)
{
sam_io_user_info23("", r_u->info.id23, ps, depth);
}
else
{
DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
return;
}
break;
}
case 24:
{
if (r_u->info.id24 != NULL)
{
sam_io_user_info24("", r_u->info.id24, ps, depth);
}
else
{
DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
return;
}
break;
}
default:
{
DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n"));
@ -4727,7 +4769,7 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps
DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n"));
return;
}
sam_io_user_info_24("", q_u->info.id24, ps, depth);
sam_io_user_info24("", q_u->info.id24, ps, depth);
break;
}
case 23: