lanman apis 47 and 53

Kevin Stefanik kstef at mtppi.org
Thu Jan 17 07:15:38 GMT 2002


I've been trying to get Snap Servers (NAS from Meridian, now Quantum)
working with Samba 2.2.2 as PDC.  The only thing that didn't work right off
was getting the group and user lists from the PDC for the Snap's security.
The snap is using two lanman api functions that Samba doesn't yet implement.

The 47 api just returns a list of groups (21 byte strings), so I copied the
NetUserGetGroups api code and took out the UserName part.  The 53 api was
the same, but users, so I just changed the hard-coded group names to
hard-coded user names.  This works fine- the snap is happy, and it gets the
user/groups lists, authenticates, etc.

I do have a question, though.  I'd like to make this actually get the real
user list, if not a meaningful group list as well.  (I vaguely recall
reading that there's some work going on to support Windows groups?)  What's
the best way to get a user list and/or group list from within this code?
Also, I'd be glad to fix the NetUserGetGroups up, too, if there's a
straight-forward interface to user/group information.

Also, does anyone know of the 'name' for these two api calls?

Thanks,
Kevin Stefanik





> /*******************************************************************
>   dummy for Unknown 47
>   ******************************************************************/
> static BOOL api_Unknown_47(connection_struct *conn,uint16 vuid, char
*param,char *data,
>                                int mdrcnt,int mprcnt,
>                                char **rdata,char **rparam,
>                                int *rdata_len,int *rparam_len)
> {
>
>   char *str1 = param+2;
>   char *str2 = skip_string(str1,1);
> /*
>   char *UserName = skip_string(str2,1);
>   char *p = skip_string(UserName,1);
> */
>   char *p = skip_string(str2,1);
>   int uLevel = SVAL(p,0);
>
>   char *p2;
>   int count=0;
>
>   *rparam_len = 8;
>   *rparam = REALLOC(*rparam,*rparam_len);
>
>   /* check it's a supported varient */
>   DEBUG(3,("47-- %s : %s : %s \n",str1, str2,p));
>   if (strcmp(str1,"WrLeh") != 0) return False;
>   switch( uLevel ) {
>   case 0: p2 = "B21"; break;
>   default: return False;
>   }
>   if (strcmp(p2,str2) != 0) return False;
>
>   *rdata_len = mdrcnt + 1024;
>   *rdata = REALLOC(*rdata,*rdata_len);
>
>   SSVAL(*rparam,0,NERR_Success);
>   SSVAL(*rparam,2,0);         /* converter word */
>
>   p = *rdata;
>
>   /* XXXX we need a real SAM database some day */
>   pstrcpy(p,"Users"); p += 21; count++;
>   pstrcpy(p,"Domain Users"); p += 21; count++;
>   pstrcpy(p,"Guests"); p += 21; count++;
>   pstrcpy(p,"Domain Guests"); p += 21; count++;
>
>   *rdata_len = PTR_DIFF(p,*rdata);
>
>   SSVAL(*rparam,4,count);     /* is this right?? */
>   SSVAL(*rparam,6,count);     /* is this right?? */
>
>   return(True);
> }
>
> /*******************************************************************
>   dummy for Unknown 53
>   ******************************************************************/
> static BOOL api_Unknown_53(connection_struct *conn,uint16 vuid, char
*param,char *data,
>                                int mdrcnt,int mprcnt,
>                                char **rdata,char **rparam,
>                                int *rdata_len,int *rparam_len)
> {
>
>   char *str1 = param+2;
>   char *str2 = skip_string(str1,1);
> /*
>   char *UserName = skip_string(str2,1);
>   char *p = skip_string(UserName,1);
> */
>   char *p = skip_string(str2,1);
>   int uLevel = SVAL(p,0);
>
>   char *p2;
>   int count=0;
>
>   *rparam_len = 8;
>   *rparam = REALLOC(*rparam,*rparam_len);
>
>   /* check it's a supported varient */
>   if (strcmp(str1,"WrLeh") != 0) return False;
>   switch( uLevel ) {
>   case 0: p2 = "B21"; break;
>   default: return False;
>   }
>   if (strcmp(p2,str2) != 0) return False;
>
>   *rdata_len = mdrcnt + 1024;
>   *rdata = REALLOC(*rdata,*rdata_len);
>
>   SSVAL(*rparam,0,NERR_Success);
>   SSVAL(*rparam,2,0);         /* converter word */
>
>   p = *rdata;
>
>   /* XXXX we need a real SAM database some day */
>   pstrcpy(p,"Administrator"); p += 21; count++;
>   pstrcpy(p,"user1"); p += 21; count++;
>   pstrcpy(p,"user2"); p += 21; count++;
>   pstrcpy(p,"user3"); p += 21; count++;
>
>   *rdata_len = PTR_DIFF(p,*rdata);
>
>   SSVAL(*rparam,4,count);     /* is this right?? */
>   SSVAL(*rparam,6,count);     /* is this right?? */
>
>   return(True);
> }
>





More information about the samba-technical mailing list