}
-static bool srv_comp(struct srv_info_struct *s1,struct srv_info_struct *s2)
+static int srv_comp(struct srv_info_struct *s1,struct srv_info_struct *s2)
{
-#undef strcasecmp
- return strcasecmp(s1->name,s2->name);
+ return StrCaseCmp(s1->name,s2->name);
}
/****************************************************************************
data_len = fixed_len = string_len = 0;
missed = 0;
- if (total > 0) {
- qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
- }
+ TYPESAFE_QSORT(servers, total, srv_comp);
{
char *lastname=NULL;
DEBUG(4,("fill_srv_info[%d] %20s %8x %25s %15s\n",
i, s->name, s->type, s->comment, s->domain));
- if (data_len <= buf_len) {
+ if (data_len < buf_len) {
counted++;
fixed_len += f_len;
string_len += s_len;
return True;
}
-static bool srv_name_match(const char *n1, const char *n2)
+static int srv_name_match(const char *n1, const char *n2)
{
/*
* [MS-RAP] footnote <88> for Section 3.2.5.15 says:
* the server will return a list of servers that exist on
* the network greater than or equal to the FirstNameToReturn.
*/
- int ret = strcasecmp(n1, n2);
+ int ret = StrCaseCmp(n1, n2);
if (ret <= 0) {
return 0;
data_len = fixed_len = string_len = 0;
missed = 0;
- if (total > 0) {
- qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
- }
+ TYPESAFE_QSORT(servers, total, srv_comp);
if (first_name[0] != '\0') {
struct srv_info_struct *first_server = NULL;
*/
for (;first > 0;) {
int ret;
- ret = strcasecmp(first_name,
+ ret = StrCaseCmp(first_name,
servers[first-1].name);
if (ret > 0) {
break;
DEBUG(4,("fill_srv_info[%d] %20s %8x %25s %15s\n",
i, s->name, s->type, s->comment, s->domain));
- if (data_len <= buf_len) {
+ if (data_len < buf_len) {
counted++;
fixed_len += f_len;
string_len += s_len;
if( lp_browseable( i ) && lp_snum_ok( i ) && (strlen(servicename_dos) < 13)) {
total++;
data_len += fill_share_info(conn,i,uLevel,0,&f_len,0,&s_len,0);
- if (data_len <= buf_len) {
+ if (data_len < buf_len) {
counted++;
fixed_len += f_len;
string_len += s_len;
vuser->server_info->sam_account);
}
/* modelled after NTAS 3.51 reply */
- SSVAL(p,usri11_priv,conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
+ SSVAL(p,usri11_priv,
+ (get_current_uid(conn) == (uid_t)0)?
+ USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,usri11_auth_flags,AF_OP_PRINT); /* auth flags */
SIVALS(p,usri11_password_age,-1); /* password age */
SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
memset(p+22,' ',16); /* password */
SIVALS(p,38,-1); /* password age */
SSVAL(p,42,
- conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
+ (get_current_uid(conn) == (uid_t)0)?
+ USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
strlcpy(p2, vuser ? pdb_get_homedir(
vuser->server_info->sam_account) : "",
PACKI(&desc,"W",0); /* code */
PACKS(&desc,"B21",name); /* eff. name */
PACKS(&desc,"B",""); /* pad */
- PACKI(&desc,"W", conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
+ PACKI(&desc,"W",
+ (get_current_uid(conn) == (uid_t)0)?
+ USER_PRIV_ADMIN:USER_PRIV_USER);
PACKI(&desc,"D",0); /* auth flags XXX */
PACKI(&desc,"W",0); /* num logons */
PACKI(&desc,"W",0); /* bad pw count */