ustubs.cpp 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. #include <sys/types.h>
  39. #include <malloc.h>
  40. #include <string.h>
  41. #include <base/crit.h>
  42. #include <base/plist.h>
  43. #include <libaccess/nserror.h>
  44. #include <libaccess/acl.h>
  45. #include "../aclpriv.h"
  46. #include <libaccess/aclproto.h>
  47. #include <libaccess/ldapacl.h>
  48. #include <ldaputil/dbconf.h>
  49. #include <prprf.h>
  50. NSPR_BEGIN_EXTERN_C
  51. extern char * ACL_Program;
  52. extern int conf_getglobals();
  53. extern int SPconf_getglobals();
  54. extern int ereport(int, char*, ...);
  55. extern int SPereport(int, char*, ...);
  56. extern char * GetAdminLanguage(void);
  57. extern char * XP_GetStringFromDatabase(char *strLibraryName, char *strLanguage, int iToken);
  58. extern void ACL_Restart(void *cntlData);
  59. extern int XP_SetError();
  60. extern int XP_GetError();
  61. extern int acl_usr_cache_init();
  62. extern int acl_usr_cache_set_group();
  63. extern int acl_usr_cache_group_check();
  64. extern int acl_usr_cache_group_len_check();
  65. extern int acl_usr_cache_enabled();
  66. extern int get_userdn_ldap (NSErr_t *errp, PList_t subject,
  67. PList_t resource, PList_t auth_info,
  68. PList_t global_auth, void *unused);
  69. extern char *ldapu_err2string(int err);
  70. extern int ACL_CacheFlush(void);
  71. NSPR_END_EXTERN_C
  72. static char errbuf[10];
  73. char *
  74. ldapu_err2string(int err)
  75. {
  76. sprintf(errbuf, "%d", err);
  77. return errbuf;
  78. }
  79. void init_ldb_rwlock ()
  80. {
  81. }
  82. #ifdef notdef
  83. char *system_errmsg()
  84. {
  85. static char errmsg[1024];
  86. sprintf(errmsg, "Stubbed system_errmsg");
  87. return errmsg;
  88. }
  89. #endif
  90. int
  91. ACL_CacheFlushRegister(AclCacheFlushFunc_t flush_func)
  92. {
  93. return 0;
  94. }
  95. int acl_usr_cache_init()
  96. {
  97. return 0;
  98. }
  99. int acl_usr_cache_group_check()
  100. {
  101. return 0;
  102. }
  103. int acl_usr_cache_set_group()
  104. {
  105. return 0;
  106. }
  107. int acl_usr_cache_group_len_check()
  108. {
  109. return 0;
  110. }
  111. int acl_usr_cache_enabled()
  112. {
  113. return 0;
  114. }
  115. int get_userdn_ldap (NSErr_t *errp, PList_t subject,
  116. PList_t resource, PList_t auth_info,
  117. PList_t global_auth, void *unused)
  118. {
  119. return LAS_EVAL_TRUE;
  120. }
  121. int XP_SetError()
  122. {
  123. return 0;
  124. }
  125. int XP_GetError()
  126. {
  127. return 0;
  128. }
  129. CRITICAL
  130. crit_init()
  131. {
  132. return (CRITICAL)1;
  133. }
  134. void
  135. crit_enter(CRITICAL c)
  136. {
  137. return;
  138. }
  139. void
  140. crit_exit(CRITICAL c)
  141. {
  142. return;
  143. }
  144. void
  145. crit_terminate(CRITICAL c)
  146. {
  147. return;
  148. }
  149. int crit_owner_is_me(CRITICAL id)
  150. {
  151. return 1;
  152. }
  153. int symTableFindSym()
  154. {
  155. return 0;
  156. }
  157. int
  158. ldap_auth_uid_groupid(LDAP *ld, char *uid, char *groupid,
  159. char *base)
  160. {
  161. return 0;
  162. }
  163. LDAP *
  164. init_ldap (char *host, int port, int use_ssl)
  165. {
  166. return (LDAP *)"init_ldap_stub";
  167. }
  168. int ACL_LDAPDatabaseHandle (NSErr_t *errp, const char *dbname, LDAP **ld,
  169. char **basedn)
  170. {
  171. *ld = (LDAP *)"ACL_LDAPDatabaseHandle_stub";
  172. if (basedn) *basedn = strdup("unknown basedn");
  173. return LAS_EVAL_TRUE;
  174. }
  175. #ifdef notdef
  176. NSEFrame_t * nserrGenerate(NSErr_t * errp, long retcode, long errorid,
  177. char * program, int errc, ...)
  178. {
  179. return 0;
  180. }
  181. #endif
  182. char * ACL_Program;
  183. char *
  184. LASUserGetUser()
  185. {
  186. return "hmiller";
  187. }
  188. int
  189. LASIpGetIp()
  190. {
  191. return(0x11223344);
  192. }
  193. int
  194. LASDnsGetDns(char **dnsv)
  195. {
  196. *dnsv = "aruba.mcom.com";
  197. return 0;
  198. }
  199. int
  200. ACL_DestroyList()
  201. {
  202. return(0);
  203. }
  204. int
  205. aclCheckHosts()
  206. {
  207. return(0);
  208. }
  209. int
  210. aclCheckUsers()
  211. {
  212. return(0);
  213. }
  214. char *LASGroupGetUser()
  215. {
  216. return("hmiller");
  217. }
  218. int
  219. SPconf_getglobals()
  220. {
  221. return 0;
  222. }
  223. int
  224. conf_getglobals()
  225. {
  226. return 0;
  227. }
  228. int
  229. SPereport(int degree, char *fmt, ...)
  230. {
  231. va_list args;
  232. char errstr[1024];
  233. va_start(args, fmt);
  234. PR_vsnprintf(&errstr[0], sizeof(errstr), fmt, args);
  235. printf("%s", errstr);
  236. va_end(args);
  237. return 0;
  238. }
  239. int
  240. ereport(int degree, char *fmt, ...)
  241. {
  242. va_list args;
  243. char errstr[1024];
  244. va_start(args, fmt);
  245. PR_vsnprintf(&errstr[0], sizeof(errstr), fmt, args);
  246. printf("%s", errstr);
  247. va_end(args);
  248. return 0;
  249. }
  250. #ifdef notdef
  251. int dbconf_read_config_file (const char *file, DBConfInfo_t **conf_info_out)
  252. {
  253. return 0;
  254. }
  255. #endif
  256. char *
  257. GetAdminLanguage(void)
  258. {
  259. return "";
  260. }
  261. static char errstr[1024];
  262. char *
  263. XP_GetStringFromDatabase(char *strLibraryName, char *strLanguage, int iToken)
  264. {
  265. sprintf(errstr, "XP_GetAdminStr called for error %d\n", iToken);
  266. return errstr;
  267. }
  268. void
  269. ACL_Restart(void * cntlData)
  270. {
  271. return;
  272. }
  273. NSAPI_PUBLIC int
  274. parse_ldap_url(NSErr_t *errp, ACLDbType_t dbtype, const char *name, const char
  275. *url, PList_t plist, void **db)
  276. {
  277. return 0;
  278. }
  279. int
  280. ACL_CacheFlush(void)
  281. {
  282. return 0;
  283. }