#include "includes.h"
-#ifdef USE_SMBGROUP_DB
+#ifdef USE_SMBPASS_DB
static int grp_file_lock_depth = 0;
extern int DEBUGLEVEL;
static pstring user_name;
struct passwd *pwfile;
pstring linebuf;
- char *p;
+ unsigned char *p;
int uidval;
+ size_t linebuf_len;
if (vp == NULL)
{
/*
* Scan the file, a line at a time.
*/
- while (getfileline(vp, linebuf, sizeof(linebuf)) > 0)
+ while ((linebuf_len = getfileline(vp, linebuf, sizeof(linebuf))) > 0)
{
/*
* The line we have should be of the form :-
*
- * username:uid:aliasrid1,aliasrid2..:domainrid1,domainrid2..:
+ * username:uid:domainrid1,domainrid2..:aliasrid1,aliasrid2..:
*/
/*
p = Atoic((char *) p, &uidval, ":");
pw_buf.smb_name = user_name;
- pw_buf.unix_uid = uidval;
+ pw_buf.smb_userid = uidval;
/*
- * Now get a list of alias RIDs
+ * Now get the password value - this should be 32 hex digits
+ * which are the ascii representations of a 16 byte string.
+ * Get two at a time and put them into the password.
*/
/* Skip the ':' */
p++;
- if (als_rids != NULL && num_alss != NULL)
+ if (grp_rids != NULL && num_grps != NULL)
{
int i;
- p = get_numlist(p, als_rids, num_alss);
+ p = get_numlist(p, grp_rids, num_grps);
if (p == NULL)
{
DEBUG(0,("getsmbfilegrpent: invalid line\n"));
return NULL;
}
+ for (i = 0; i < (*num_grps); i++)
+ {
+ (*grp_rids)[i] = pwdb_gid_to_group_rid((*grp_rids)[i]);
+ }
}
- /*
- * Now get a list of group RIDs
- */
-
/* Skip the ':' */
p++;
- if (grp_rids != NULL && num_grps != NULL)
+ if (als_rids != NULL && num_alss != NULL)
{
int i;
- p = get_numlist(p, grp_rids, num_grps);
+ p = get_numlist(p, als_rids, num_alss);
if (p == NULL)
{
DEBUG(0,("getsmbfilegrpent: invalid line\n"));
return NULL;
}
+ for (i = 0; i < (*num_alss); i++)
+ {
+ (*als_rids)[i] = pwdb_gid_to_alias_rid((*als_rids)[i]);
+ }
}
pwfile = Get_Pwnam(pw_buf.smb_name, False);