ustubs.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. #include <sys/types.h>
  42. #include <malloc.h>
  43. #include <string.h>
  44. #include <base/crit.h>
  45. #include <base/plist.h>
  46. #include <libaccess/nserror.h>
  47. #include <libaccess/acl.h>
  48. #include "../aclpriv.h"
  49. #include <libaccess/aclproto.h>
  50. #include <libaccess/ldapacl.h>
  51. #include <ldaputil/dbconf.h>
  52. #include <prprf.h>
  53. NSPR_BEGIN_EXTERN_C
  54. extern char * ACL_Program;
  55. extern int conf_getglobals();
  56. extern int SPconf_getglobals();
  57. extern int ereport(int, char*, ...);
  58. extern int SPereport(int, char*, ...);
  59. extern char * GetAdminLanguage(void);
  60. extern char * XP_GetStringFromDatabase(char *strLibraryName, char *strLanguage, int iToken);
  61. extern void ACL_Restart(void *cntlData);
  62. extern int XP_SetError();
  63. extern int XP_GetError();
  64. extern int acl_usr_cache_init();
  65. extern int acl_usr_cache_set_group();
  66. extern int acl_usr_cache_group_check();
  67. extern int acl_usr_cache_group_len_check();
  68. extern int acl_usr_cache_enabled();
  69. extern int get_userdn_ldap (NSErr_t *errp, PList_t subject,
  70. PList_t resource, PList_t auth_info,
  71. PList_t global_auth, void *unused);
  72. extern char *ldapu_err2string(int err);
  73. extern int ACL_CacheFlush(void);
  74. NSPR_END_EXTERN_C
  75. static char errbuf[10];
  76. char *
  77. ldapu_err2string(int err)
  78. {
  79. sprintf(errbuf, "%d", err);
  80. return errbuf;
  81. }
  82. void init_ldb_rwlock ()
  83. {
  84. }
  85. #ifdef notdef
  86. char *system_errmsg()
  87. {
  88. static char errmsg[1024];
  89. sprintf(errmsg, "Stubbed system_errmsg");
  90. return errmsg;
  91. }
  92. #endif
  93. int
  94. ACL_CacheFlushRegister(AclCacheFlushFunc_t flush_func)
  95. {
  96. return 0;
  97. }
  98. int acl_usr_cache_init()
  99. {
  100. return 0;
  101. }
  102. int acl_usr_cache_group_check()
  103. {
  104. return 0;
  105. }
  106. int acl_usr_cache_set_group()
  107. {
  108. return 0;
  109. }
  110. int acl_usr_cache_group_len_check()
  111. {
  112. return 0;
  113. }
  114. int acl_usr_cache_enabled()
  115. {
  116. return 0;
  117. }
  118. int get_userdn_ldap (NSErr_t *errp, PList_t subject,
  119. PList_t resource, PList_t auth_info,
  120. PList_t global_auth, void *unused)
  121. {
  122. return LAS_EVAL_TRUE;
  123. }
  124. int XP_SetError()
  125. {
  126. return 0;
  127. }
  128. int XP_GetError()
  129. {
  130. return 0;
  131. }
  132. CRITICAL
  133. crit_init()
  134. {
  135. return (CRITICAL)1;
  136. }
  137. void
  138. crit_enter(CRITICAL c)
  139. {
  140. return;
  141. }
  142. void
  143. crit_exit(CRITICAL c)
  144. {
  145. return;
  146. }
  147. void
  148. crit_terminate(CRITICAL c)
  149. {
  150. return;
  151. }
  152. int crit_owner_is_me(CRITICAL id)
  153. {
  154. return 1;
  155. }
  156. int symTableFindSym()
  157. {
  158. return 0;
  159. }
  160. int
  161. ldap_auth_uid_groupid(LDAP *ld, char *uid, char *groupid,
  162. char *base)
  163. {
  164. return 0;
  165. }
  166. LDAP *
  167. init_ldap (char *host, int port, int use_ssl)
  168. {
  169. return (LDAP *)"init_ldap_stub";
  170. }
  171. int ACL_LDAPDatabaseHandle (NSErr_t *errp, const char *dbname, LDAP **ld,
  172. char **basedn)
  173. {
  174. *ld = (LDAP *)"ACL_LDAPDatabaseHandle_stub";
  175. if (basedn) *basedn = strdup("unknown basedn");
  176. return LAS_EVAL_TRUE;
  177. }
  178. #ifdef notdef
  179. NSEFrame_t * nserrGenerate(NSErr_t * errp, long retcode, long errorid,
  180. char * program, int errc, ...)
  181. {
  182. return 0;
  183. }
  184. #endif
  185. char * ACL_Program;
  186. char *
  187. LASUserGetUser()
  188. {
  189. return "hmiller";
  190. }
  191. int
  192. LASIpGetIp()
  193. {
  194. return(0x11223344);
  195. }
  196. int
  197. LASDnsGetDns(char **dnsv)
  198. {
  199. *dnsv = "aruba.mcom.com";
  200. return 0;
  201. }
  202. int
  203. ACL_DestroyList()
  204. {
  205. return(0);
  206. }
  207. int
  208. aclCheckHosts()
  209. {
  210. return(0);
  211. }
  212. int
  213. aclCheckUsers()
  214. {
  215. return(0);
  216. }
  217. char *LASGroupGetUser()
  218. {
  219. return("hmiller");
  220. }
  221. int
  222. SPconf_getglobals()
  223. {
  224. return 0;
  225. }
  226. int
  227. conf_getglobals()
  228. {
  229. return 0;
  230. }
  231. int
  232. SPereport(int degree, char *fmt, ...)
  233. {
  234. va_list args;
  235. char errstr[1024];
  236. va_start(args, fmt);
  237. PR_vsnprintf(&errstr[0], sizeof(errstr), fmt, args);
  238. printf("%s", errstr);
  239. va_end(args);
  240. return 0;
  241. }
  242. int
  243. ereport(int degree, char *fmt, ...)
  244. {
  245. va_list args;
  246. char errstr[1024];
  247. va_start(args, fmt);
  248. PR_vsnprintf(&errstr[0], sizeof(errstr), fmt, args);
  249. printf("%s", errstr);
  250. va_end(args);
  251. return 0;
  252. }
  253. #ifdef notdef
  254. int dbconf_read_config_file (const char *file, DBConfInfo_t **conf_info_out)
  255. {
  256. return 0;
  257. }
  258. #endif
  259. char *
  260. GetAdminLanguage(void)
  261. {
  262. return "";
  263. }
  264. static char errstr[1024];
  265. char *
  266. XP_GetStringFromDatabase(char *strLibraryName, char *strLanguage, int iToken)
  267. {
  268. sprintf(errstr, "XP_GetAdminStr called for error %d\n", iToken);
  269. return errstr;
  270. }
  271. void
  272. ACL_Restart(void * cntlData)
  273. {
  274. return;
  275. }
  276. NSAPI_PUBLIC int
  277. parse_ldap_url(NSErr_t *errp, ACLDbType_t dbtype, const char *name, const char
  278. *url, PList_t plist, void **db)
  279. {
  280. return 0;
  281. }
  282. int
  283. ACL_CacheFlush(void)
  284. {
  285. return 0;
  286. }