/*
SSSD
NSS Responder
Authors:
Pallavi Jha <pallavikumarijha@gmail.com>
Copyright (C) 2013 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 <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
#include <setjmp.h>
#include <errno.h>
#include <unistd.h>
#include <inttypes.h>
#include <cmocka.h>
#include "tests/cmocka/common_mock.h"
#include "tests/cmocka/common_mock_resp.h"
#include "responder/nss/nsssrv_private.h"
#include "sss_client/idmap/sss_nss_idmap.h"
#include "util/util_sss_idmap.h"
#include "lib/idmap/sss_idmap.h"
#include "util/util_sss_idmap.h"
#include "responder/common/responder.h"
#include "responder/common/negcache.h"
#define CERT "MIIECTCCAvGgAwIBAgIBCTANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQKDAlJUEEuREVWRUwxHjAcBgNVBAMMFUNlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xNTA0MjgxMDIxMTFaFw0xNzA0MjgxMDIxMTFaMDIxEjAQBgNVBAoMCUlQQS5ERVZFTDEcMBoGA1UEAwwTaXBhLWRldmVsLmlwYS5kZXZlbDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALIykqtHuAwTVEofHikG/9BQy/dfeZFlsTkBg2qtnnc78w3XufbcnkpJp9Bmcsy/d9beqf5nlsxJ8TcjLsRQ9Ou6YtQjTfM3OILuOz8s0ICbF6qb66bd9hX/BrLO/9+KnpWFSR+E/YEmzgYyDTbKfBWBaGuPPrOi/K6vwkRYFZVA/FYZkYDtQhFmBO884HYzS4P6frRH3PvtRqWNCmaHpe97dGKsvnM2ybT+IMSB8/54GajQr3+BciRh2XaT4wvSTxkXM1fUgrDxqAP2AZmpuIyDyboZh+rWOwbrTPfx5SipELZG3uHhP8HMcr4qQ8b20LWgxCRuT73sIooHET350xUCAwEAAaOCASYwggEiMB8GA1UdIwQYMBaAFPKdQk4PxEglWC8czg+hPyLIVciRMDsGCCsGAQUFBwEBBC8wLTArBggrBgEFBQcwAYYfaHR0cDovL2lwYS1jYS5pcGEuZGV2ZWwvY2Evb2NzcDAOBgNVHQ8BAf8EBAMCBPAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMHQGA1UdHwRtMGswaaAxoC+GLWh0dHA6Ly9pcGEtY2EuaXBhLmRldmVsL2lwYS9jcmwvTWFzdGVyQ1JMLmJpbqI0pDIwMDEOMAwGA1UECgwFaXBhY2ExHjAcBgNVBAMMFUNlcnRpZmljYXRlIEF1dGhvcml0eTAdBgNVHQ4EFgQULSs/y/Wy/zIsqMIc3b2MgB7dMYIwDQYJKoZIhvcNAQELBQADggEBAJpHLlCnTR1TD8lxQgzl2n1JZOeryN/fAsGH0Vve2m8r5PC+ugnfAoULiuabBn1pOGxy/0x7Kg0/Iy8WRv8Fk7DqJCjXEqFXuFkZJfNDCtP9DzeNuMoV50iKoMfHS38BPFjXN+X/fSsBrA2fUWrlQCTmXlUN97gvQqxt5Slrxgukvxm9OSfu/sWz22LUvtJHupYwWv1iALgnXS86lAuVNYVALLxn34r58XsZlj5CSBMjBJWpaxEzgUdag3L2IPqOQXuPd0d8x11G9E/9gQquOSe2aiZjsdO/VYOCmzZsM2QPUMBVlBPDhfTVcWXQwN385uycW/ARtSzzSME2jKKWSIQ="
/* register_cli_protocol_version is required in test since it links with
* responder_common.c module
*/
{
};
}
/* Mock NSS structure */
static struct nss_ctx *
{
if (!nctx) {
return NULL;
}
if (err != IDMAP_SUCCESS) {
return NULL;
}
return nctx;
}
struct test_state {
};
{
int ret;
return 0;
}
{
return 0;
}
{
int ret;
}
/* @test_sss_ncache_uid : test following functions
* sss_ncache_set_uid
* sss_ncache_check_uid
*/
{
int ret;
bool permanent;
/* test when uid not present in database */
/* test when uid is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_gid : test following functions
* sss_ncache_set_gid
* sss_ncache_check_gid
*/
{
int ret;
bool permanent;
/* test when gid is not present in database */
/* test when gid is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_sid : test following functions
* sss_ncache_set_sid
* sss_ncache_check_sid
*/
{
int ret;
bool permanent;
/*test when sid in not present in database */
/* test when sid is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_cert : test following functions
* sss_ncache_set_cert
* sss_ncache_check_cert_
*/
{
int ret;
bool permanent;
/*test when cert in not present in database */
/* test when cert is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_user : test following functions
* sss_ncache_check_user
* sss_ncache_set_user
*/
{
int ret;
bool permanent;
char *name;
/* test when domain name is not present in database */
dom->case_sensitive = false;
dom->case_sensitive = true;
/* test when domain name is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_group : test following functions
* sss_ncache_check_group
* sss_ncache_set_group
*/
{
int ret;
bool permanent;
char *name;
/* test when domain name is not present in database */
dom->case_sensitive = false;
dom->case_sensitive = true;
/* test when domain name is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_netgr : test following functions
* sss_ncache_check_netgr
* sss_ncache_set_netgr
*/
{
int ret;
bool permanent;
/* test when domain name is not present in database */
dom->case_sensitive = false;
dom->case_sensitive = true;
/* test when domain name is present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_service_name : test following functions
* sss_ncache_check_service
* sss_ncache_set_service_name
*/
{
int ret;
bool permanent;
/* test when domain name and protocol are not present in database */
dom->case_sensitive = false;
dom->case_sensitive = true;
/* test when domain name and protocol are present in database */
permanent = true;
permanent = false;
}
/* @test_sss_ncache_service_port : test following functions
* sss_ncache_check_service_port
* sss_ncache_set_service_port
*/
{
int ret;
bool permanent;
/* test when domain name, port and protocol are not present in database */
dom->case_sensitive = false;
PROTO);
dom->case_sensitive = true;
PROTO);
/* test when domain name, port and protocol are present in database */
permanent = true;
PROTO);
PROTO);
permanent = false;
PROTO);
PROTO);
}
{
int ret;
const bool permanent = true;
}
struct sss_domain_info *dom,
const char *name)
{
char *fqdn;
int ret;
return ret;
}
struct sss_domain_info *dom,
const char *name)
{
char *fqdn;
int ret;
return ret;
}
{
int ret;
};
}
{
int ret;
};
}
{
int ret;
};
"filter_users", nss_filter_users);
"filter_groups", nss_filter_groups);
/* Add another domain */
/* First domain should not be known, the second not */
/* First domain should not be known, the second not */
}
int main(void)
{
int rv;
teardown),
teardown),
};
if (rv == 0) {
}
return rv;
}