sysdb_idmap.c revision 3a59cbd0b7b9c5dd3c62ac1679876070c264d80f
/*
SSSD
Authors:
Stephen Gallagher <sgallagh@redhat.com>
Copyright (C) 2012 Red Hat
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 "db/sysdb_private.h"
struct ldb_dn *
const char *object_sid)
{
char *clean_sid;
return NULL;
}
return dn;
}
const char *dom_name,
const char *dom_sid,
{
int lret;
bool in_transaction = false;
static const char *attrs[] = SYSDB_IDMAP_ATTRS;
struct ldb_message *update_msg;
struct ldb_message **msgs;
const char *old_name;
if (!dn) {
goto done;
}
if (!update_msg) {
goto done;
}
goto done;
}
in_transaction = true;
/* Check for an existing mapping */
/* More than one reply for a base search? */
goto done;
/* Create a new mapping */
("Adding new ID mapping [%s][%s][%lu]\n",
/* Add the objectClass */
NULL);
if (lret != LDB_SUCCESS) {
goto done;
}
if (lret != LDB_SUCCESS) {
goto done;
}
/* Add the domain objectSID */
NULL);
if (lret != LDB_SUCCESS) {
goto done;
}
if (lret != LDB_SUCCESS) {
goto done;
}
/* Add the domain name */
NULL);
if (lret != LDB_SUCCESS) {
goto done;
}
if (lret != LDB_SUCCESS) {
goto done;
}
/* Add the slice number */
NULL);
if (lret != LDB_SUCCESS) {
goto done;
}
"%lu", (unsigned long)slice_num);
if (lret != LDB_SUCCESS) {
goto done;
}
if (lret != LDB_SUCCESS) {
("Failed to add mapping: [%s]\n",
ldb_strerror(lret)));
goto done;
}
} else {
/* Update the existing mapping */
/* Check whether the slice has changed
* This should never happen, and it's a recipe for
* disaster. We'll throw an error if it does.
*/
-1);
if (old_slice == -1) {
("Could not identify original slice for SID [%s]\n",
dom_sid));
goto done;
}
("Detected attempt to change slice value for sid [%s] "
"This will break existing users. Refusing to perform.\n"));
goto done;
}
/* Check whether the name has changed. This may happen
* if we're told the real name of a domain and want to
* replace the SID as placeholder.
*/
if (!old_name) {
("Could not identify original domain name of SID [%s]\n",
dom_sid));
goto done;
}
/* There's nothing to be done. We don't need to
* make any changes here. Just return success.
*/
("No changes needed, canceling transaction\n"));
goto done;
} else {
/* The name has changed. Replace it */
("Changing domain name of SID [%s] from [%s] to [%s]\n",
/* Set the new name */
NULL);
if (lret != LDB_SUCCESS) {
goto done;
}
if (lret != LDB_SUCCESS) {
goto done;
}
}
if (lret != LDB_SUCCESS) {
("Failed to update mapping: [%s]\n",
ldb_strerror(lret)));
goto done;
}
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
("Could not cancel transaction\n"));
}
}
return ret;
}
struct ldb_result **_result)
{
int lret;
struct ldb_result *res;
static const char *attrs[] = SYSDB_IDMAP_ATTRS;
if (!base_dn) {
goto done;
}
if (lret) {
("Could not locate ID mappings: [%s]\n",
ldb_strerror(lret)));
goto done;
}
done:
return ret;
}