pacsrv_utils.c revision e13baa8dab9741d9221d3794fd8abf3d461f8d6d
/*
SSSD
PAC Responder - utility finctions
Copyright (C) Sumit Bose <sbose@redhat.com> 2012
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <util/data_blob.h>
#include <gen_ndr/security.h>
{
return EINVAL;
}
return EOK;
}
/**
* Find the Posix ID to a SID from the local IPA domain
*/
{
int ret;
return EINVAL;
}
return ret;
}
} else {
return ENOENT;
}
return ERANGE;
}
return EOK;
}
/**
* Add a new remote domain and the corresponding ID range to the context of
* the libsss_idmap. Without this it is not possible to find the Posix UID for
* a user fo the remote domain.
*/
const char *domain_name,
const char *dom_sid_str)
{
struct sss_idmap_range range = {0, 0};
enum idmap_error_code err;
struct range_info **range_list;
size_t c;
int ret;
return EINVAL;
}
return ENOMEM;
}
goto done;
}
for (c = 0; c < range_count; c++) {
/* TODO: add support for multiple ranges. */
break;
}
}
goto done;
}
if (err != IDMAP_SUCCESS) {
return EFAULT;
}
done:
return ret;
}
/**
* Find the corresponding UID for a user from a remote domain based on the
* domain SID of the remote domain and the RID of the user.
*/
const char *domain_name,
{
enum idmap_error_code err;
char *dom_sid_str = NULL;
int ret;
&dom_sid_str);
if (err != IDMAP_SUCCESS) {
goto done;
}
return ENOMEM;
}
if (err != IDMAP_SUCCESS) {
goto done;
}
if (err == IDMAP_NO_DOMAIN) {
goto done;
}
if (err != IDMAP_SUCCESS) {
"even in the second attempt.\n"));
goto done;
}
goto done;
}
done:
return ret;
}
/**
* Return information about the local domain from the main PAC responder
* context or try to read it from cache and store it in the context.
*/
struct sss_domain_info *dom,
struct local_mapping_ranges **_range_map)
{
int ret;
const char *attrs[] = {SYSDB_SUBDOMAIN_ID,
NULL};
const char *sid_str;
struct ldb_message **msgs;
char *dom_name;
enum idmap_error_code err;
struct range_info **range_list;
size_t c;
} else {
}
goto done;
}
goto done;
}
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
if (msgs_count != 1) {
"expected 1.\n", msgs_count));
goto done;
}
goto done;
}
if (err != IDMAP_SUCCESS) {
goto done;
}
sizeof(struct dom_sid));
goto done;
}
}
goto done;
}
for (c = 0; c < range_count; c++) {
range_list[c]->secondary_base_rid != 0) {
struct local_mapping_ranges);
goto done;
}
/* TODO: add support for multiple ranges. */
break;
}
}
goto done;
}
}
}
done:
return ret;
}
/**
* Check if a given SID belongs to a domain identified by the domain SID.
*/
{
size_t c;
if (!domain_sid || !sid) {
return false;
}
return false;
}
for (c = 0; c < 6; c++) {
return false;
}
}
return false;
}
return false;
}
}
return true;
}
/**
* Find all Posix GIDs from a PAC by searching for group SIDs from the local
* domain and convert them to GIDs.
*/
struct local_mapping_ranges *range_map,
struct dom_sid *domain_sid,
struct PAC_LOGON_INFO *logon_info,
{
int ret;
size_t g = 0;
size_t s;
struct netr_SamInfo3 *info3;
goto done;
}
goto done;
}
goto done;
}
"with gid [%d].\n", gids[g]));
g++;
}
}
done:
*_gid_count = g;
} else {
}
return ret;
}
/**
* Extract the PAC logon data from an NDR blob.
*/
struct PAC_LOGON_INFO **_logon_info)
{
enum ndr_err_code ndr_err;
size_t c;
int ret;
return ENOMEM;
}
return ENOMEM;
}
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return EBADMSG;
}
for(c = 0; c < pac_data->num_buffers; c++) {
return EOK;
}
}
return ret;
}
/**
* Fill up the passwd struct with data from the PAC logon info
*/
struct sss_domain_info *dom,
struct PAC_LOGON_INFO *logon_info,
{
struct netr_SamBaseInfo *base_info;
int ret;
return ENOMEM;
}
goto done;
}
} else {
goto done;
}
goto done;
}
} else {
goto done;
}
goto done;
}
} else {
"gecos field will by empty.\n "));
}
if (dom->subdomain_homedir) {
goto done;
}
}
done:
}
return ret;
}