예제 #1
0
static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
				       const DOM_SID *sid, 
				       TALLOC_CTX *ctx,
				       ADS_STRUCT *ads,
				       LDAPMessage *msg,
				       char **homedir,
				       char **shell, 
				       char **gecos,
				       gid_t *gid )
{     
	if ( !homedir || !shell || !gecos )
		return NT_STATUS_INVALID_PARAMETER;
	
	/* protect against home directories using whitespace in the
	  username */
	*homedir = talloc_strdup( ctx, lp_template_homedir() );
	*shell   = talloc_strdup( ctx, lp_template_shell() );
	*gecos   = NULL;

	if ( !*homedir || !*shell ) {
		return NT_STATUS_NO_MEMORY;
	}
	
	return NT_STATUS_OK;
}
예제 #2
0
static bool winbindd_fill_pwent(char *dom_name, char *user_name,
                                DOM_SID *user_sid, DOM_SID *group_sid,
                                char *full_name, char *homedir, char *shell,
                                struct winbindd_pw *pw)
{
    fstring output_username;

    if (!pw || !dom_name || !user_name)
        return False;

    /* Resolve the uid number */

    if (!NT_STATUS_IS_OK(idmap_sid_to_uid(user_sid, &pw->pw_uid))) {
        DEBUG(1, ("error getting user id for sid %s\n",
                  sid_string_dbg(user_sid)));
        return False;
    }

    /* Resolve the gid number */

    if (!NT_STATUS_IS_OK(idmap_sid_to_gid(group_sid, &pw->pw_gid))) {
        DEBUG(1, ("error getting group id for sid %s\n",
                  sid_string_dbg(group_sid)));
        return False;
    }

    strlower_m(user_name);

    /* Username */

    fill_domain_username(output_username, dom_name, user_name, True);

    safe_strcpy(pw->pw_name, output_username, sizeof(pw->pw_name) - 1);

    /* Full name (gecos) */

    safe_strcpy(pw->pw_gecos, full_name, sizeof(pw->pw_gecos) - 1);

    /* Home directory and shell */

    if (!fillup_pw_field(lp_template_homedir(), user_name, dom_name,
                         pw->pw_uid, pw->pw_gid, homedir, pw->pw_dir))
        return False;

    if (!fillup_pw_field(lp_template_shell(), user_name, dom_name,
                         pw->pw_uid, pw->pw_gid, shell, pw->pw_shell))
        return False;

    /* Password - set to "*" as we can't generate anything useful here.
       Authentication can be done using the pam_winbind module. */

    safe_strcpy(pw->pw_passwd, "*", sizeof(pw->pw_passwd) - 1);

    return True;
}
예제 #3
0
파일: py_winbind.c 프로젝트: hajuuk/R7000
static PyObject *py_config_dict(void)
{
	PyObject *result;
	uid_t ulow, uhi;
	gid_t glow, ghi;
	
	if (!(result = PyDict_New()))
		return NULL;

	/* Various string parameters */

	PyDict_SetItemString(result, "workgroup", 
			     PyString_FromString(lp_workgroup()));

	PyDict_SetItemString(result, "separator", 
			     PyString_FromString(lp_winbind_separator()));

	PyDict_SetItemString(result, "template_homedir", 
			     PyString_FromString(lp_template_homedir()));

	PyDict_SetItemString(result, "template_shell", 
			     PyString_FromString(lp_template_shell()));

	/* idmap uid/gid range */

	if (lp_idmap_uid(&ulow, &uhi)) {
		PyDict_SetItemString(result, "uid_low", PyInt_FromLong(ulow));
		PyDict_SetItemString(result, "uid_high", PyInt_FromLong(uhi));
	}

	if (lp_idmap_gid(&glow, &ghi)) {
		PyDict_SetItemString(result, "gid_low", PyInt_FromLong(glow));
		PyDict_SetItemString(result, "gid_high", PyInt_FromLong(ghi));
	}

	return result;
}