/*
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"
#include "db/sysdb_services.h"
static errno_t
int port,
const char **aliases,
const char **protocols);
const char *alias);
struct sss_domain_info *domain,
const char *name,
const char *proto,
struct ldb_result **_res)
{
char *sanitized_name;
char *sanitized_proto;
char *subfilter;
if (!tmp_ctx) {
return ENOMEM;
}
goto done;
}
if (proto) {
goto done;
}
}
if (!subfilter) {
goto done;
}
if (!res) {
goto done;
}
}
done:
return ret;
}
struct sss_domain_info *domain,
int port,
const char *proto,
struct ldb_result **_res)
{
char *subfilter;
if (port <= 0) {
return EINVAL;
}
if (!tmp_ctx) {
return ENOMEM;
}
if (proto) {
goto done;
}
}
(unsigned int) port);
if (!subfilter) {
goto done;
}
if (!res) {
goto done;
}
}
done:
return ret;
}
const char *primary_name,
int port,
const char **aliases,
const char **protocols,
struct sysdb_attrs *extra_attrs,
char **remove_attrs,
{
bool in_transaction = false;
const char *name;
unsigned int i;
goto done;
}
in_transaction = true;
/* Check that the port is unique
* If the port appears for any service other than
* the one matching the primary_name, we need to
* remove them so that getservbyport() can work
* properly. Last entry saved to the cache should
* always "win".
*/
goto done;
/* Somehow the cache has multiple entries with
* the same port. This is corrupted. We'll delete
* them all to sort it out.
*/
"Corrupt cache entry [%s] detected. Deleting\n",
"Could not delete corrupt cache entry [%s]\n",
goto done;
}
}
} else {
/* Check whether this is the same name as we're currently
* saving to the cache.
*/
NULL);
if (!name) {
"A service with no name?\n");
/* Corrupted */
}
/* Either this is a corrupt entry or it's another service
* claiming ownership of this port. In order to account
* for port reassignments, we need to delete the old entry.
*/
"Corrupt or replaced cache entry [%s] detected. "
"Deleting\n",
"Could not delete cache entry [%s]\n",
}
}
}
}
/* Ok, ports should now be unique. Now look
* the service up by name to determine if we
* need to update existing entries or modify
* aliases.
*/
goto done;
/* Check whether this is the same name as we're currently
* saving to the cache.
*/
NULL);
if (!name) {
/* Corrupted */
"A service with no name?\n");
"Corrupt cache entry [%s] detected. Deleting\n",
"Could not delete corrupt cache entry [%s]\n",
goto done;
}
/* This is the same service name, so we need
* to update this entry with the values
* provided.
*/
if(update_dn) {
"Two existing services with the same name: [%s]? "
"Deleting both.\n",
/* Delete the entry from the previous pass */
"Could not delete cache entry [%s]\n",
update_dn));
goto done;
}
/* Delete the new entry as well */
"Could not delete cache entry [%s]\n",
goto done;
}
} else {
}
} else {
/* Another service is claiming this name as an alias.
* In order to account for aliases being promoted to
* primary names, we need to make sure to remove the
* old alias entry.
*/
}
}
}
if (update_dn) {
/* Update the existing entry */
} else {
/* Add a new entry */
}
/* Set the cache timeout */
if (!extra_attrs) {
if (!attrs) {
goto done;
}
} else {
attrs = extra_attrs;
}
((cache_timeout) ?
(now + cache_timeout) : 0));
if (remove_attrs) {
"Could not remove missing attributes: [%s]\n",
goto done;
}
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
return ret;
}
struct ldb_dn *
{
char *clean_name;
return NULL;
}
clean_name, domain);
return dn;
}
struct sss_domain_info *domain,
const char *primary_name,
int port,
const char **aliases,
const char **protocols,
{
int lret;
unsigned long i;
if (!msg) {
goto done;
}
/* svc dn */
goto done;
}
/* Objectclass */
/* Set the primary name */
/* Set the port number */
/* If this service has any aliases, include them */
/* Set the name aliases */
if (lret != LDB_SUCCESS) {
goto done;
}
for (i=0; aliases[i]; i++) {
if (lret != LDB_SUCCESS) {
goto done;
}
}
}
/* Set the protocols */
if (lret != LDB_SUCCESS) {
goto done;
}
for (i=0; protocols[i]; i++) {
if (lret != LDB_SUCCESS) {
goto done;
}
}
/* creation time */
}
done:
if (ret) {
}
return ret;
}
static errno_t
int port,
const char **aliases,
const char **protocols)
{
int lret;
unsigned int i;
return EINVAL;
}
if (!msg) {
goto done;
}
/* Update the port */
/* Update the aliases */
if (lret != LDB_SUCCESS) {
goto done;
}
for (i = 0; aliases[i]; i++) {
if (lret != LDB_SUCCESS) {
goto done;
}
}
}
/* Update the protocols */
if (lret != LDB_SUCCESS) {
goto done;
}
for (i = 0; protocols[i]; i++) {
if (lret != LDB_SUCCESS) {
goto done;
}
}
if (lret != LDB_SUCCESS) {
"ldb_modify failed: [%s](%d)[%s]\n",
}
done:
if (ret) {
}
return ret;
}
const char *alias)
{
int lret;
if (!msg) {
goto done;
}
if (lret != LDB_SUCCESS) {
"ldb_modify failed: [%s](%d)[%s]\n",
}
done:
if (ret) {
}
return ret;
}
const char *name,
int port,
const char *proto)
{
unsigned int i;
bool in_transaction = false;
if (!tmp_ctx) {
return ENOMEM;
}
goto done;
}
in_transaction = true;
if (name) {
/* Doesn't exist in the DB. Nothing to do */
goto done;
}
} else {
/* Doesn't exist in the DB. Nothing to do */
goto done;
}
}
/* There should only be one matching entry,
* but if there are multiple, we should delete
* them all to de-corrupt the DB.
*/
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
"Could not cancel transaction\n");
}
}
}
return ret;
}
struct sss_domain_info *domain,
struct ldb_result **_res)
{
if (!tmp_ctx) {
return ENOMEM;
}
if (!res) {
goto done;
}
}
done:
return ret;
}
const char *name,
struct sysdb_attrs *attrs,
int mod_op)
{
if (!tmp_ctx) {
return ENOMEM;
}
if (!dn) {
goto done;
}
done:
return ret;
}
struct sss_domain_info *domain,
const char *sub_filter,
const char **attrs,
struct ldb_message ***msgs)
{
char *filter;
int ret;
if (!tmp_ctx) {
return ENOMEM;
}
if (!basedn) {
goto fail;
}
if (!filter) {
goto fail;
}
"Search services with filter: %s\n", filter);
msgs_count, msgs);
if (ret) {
goto fail;
}
return EOK;
fail:
}
else if (ret) {
}
return ret;
}