Lines Matching refs:sysdb
103 static errno_t sysdb_chown_db_files(struct sysdb_ctx *sysdb,
108 ret = chown(sysdb->ldb_file, uid, gid);
112 "Cannot set sysdb ownership of %s to %"SPRIuid":%"SPRIgid"\n",
113 sysdb->ldb_file, uid, gid);
117 if (sysdb->ldb_ts_file != NULL) {
118 ret = chown(sysdb->ldb_ts_file, uid, gid);
122 "Cannot set sysdb ownership of %s to %"SPRIuid":%"SPRIgid"\n",
123 sysdb->ldb_ts_file, uid, gid);
273 errno_t sysdb_domain_create(struct sysdb_ctx *sysdb, const char *domain_name)
275 return sysdb_domain_create_int(sysdb->ldb, domain_name);
278 /* Compare versions of sysdb, returns ERRNO accordingly */
355 struct sysdb_ctx *sysdb,
361 /* Currently the sysdb cache only has one version */
366 struct sysdb_ctx *sysdb,
388 save_ldb = sysdb->ldb;
389 sysdb->ldb = ldb;
402 ret = sysdb_upgrade_03(sysdb, &version);
409 ret = sysdb_upgrade_04(sysdb, &version);
416 ret = sysdb_upgrade_05(sysdb, &version);
423 ret = sysdb_upgrade_06(sysdb, &version);
430 ret = sysdb_upgrade_07(sysdb, &version);
437 ret = sysdb_upgrade_08(sysdb, &version);
444 ret = sysdb_upgrade_09(sysdb, &version);
451 ret = sysdb_upgrade_10(sysdb, domain, &version);
458 ret = sysdb_upgrade_11(sysdb, domain, &version);
465 ret = sysdb_upgrade_12(sysdb, &version);
472 ret = sysdb_upgrade_13(sysdb, &version);
479 ret = sysdb_upgrade_14(sysdb, &version);
486 ret = sysdb_upgrade_15(sysdb, &version);
493 ret = sysdb_upgrade_16(sysdb, &version);
500 ret = sysdb_upgrade_17(sysdb, upgrade_ctx, &version);
508 sysdb->ldb = save_ldb;
514 static errno_t remove_ts_cache(struct sysdb_ctx *sysdb)
518 if (sysdb->ldb_ts_file == NULL) {
522 ret = unlink(sysdb->ldb_ts_file);
531 struct sysdb_ctx *sysdb,
646 struct sysdb_ctx *sysdb,
655 ldb_file_exists = !(access(sysdb->ldb_file, F_OK) == -1 && errno == ENOENT);
657 ret = sysdb_cache_connect_helper(mem_ctx, sysdb, domain, sysdb->ldb_file,
663 ret = remove_ts_cache(sysdb);
675 struct sysdb_ctx *sysdb,
680 return sysdb_cache_connect_helper(mem_ctx, sysdb, domain, sysdb->ldb_ts_file,
686 static int sysdb_domain_cache_connect(struct sysdb_ctx *sysdb,
700 ret = sysdb_cache_connect(tmp_ctx, sysdb, domain, &ldb, &version);
710 ret = sysdb_domain_cache_upgrade(tmp_ctx, sysdb, upgrade_ctx,
719 ret = remove_ts_cache(sysdb);
740 ret = sysdb_ldb_reconnect(tmp_ctx, sysdb->ldb_file, 0, &ldb);
755 sysdb->ldb = talloc_steal(sysdb, ldb);
761 static int sysdb_timestamp_cache_connect(struct sysdb_ctx *sysdb,
770 if (sysdb->ldb_ts_file == NULL) {
780 ret = sysdb_ts_cache_connect(tmp_ctx, sysdb, domain, &ldb, &version);
790 ret = sysdb_ts_cache_upgrade(tmp_ctx, sysdb, ldb, domain, version,
812 sysdb->ldb_ts_file,
836 ret = remove_ts_cache(sysdb);
847 ret = sysdb_ts_cache_connect(tmp_ctx, sysdb, domain, &ldb, &version);
856 sysdb->ldb_ts = talloc_steal(sysdb, ldb);
869 struct sysdb_ctx *sysdb;
877 sysdb = talloc_zero(mem_ctx, struct sysdb_ctx);
878 if (!sysdb) {
883 ret = sysdb_get_db_file(sysdb, domain->provider, domain->name, db_path,
884 &sysdb->ldb_file, &sysdb->ldb_ts_file);
889 "DB File for %s: %s\n", domain->name, sysdb->ldb_file);
890 if (sysdb->ldb_ts_file) {
892 "Timestamp file for %s: %s\n", domain->name, sysdb->ldb_ts_file);
895 ret = sysdb_domain_cache_connect(sysdb, domain, upgrade_ctx);
898 "Could not open the sysdb cache [%d]: %s\n",
903 ret = sysdb_timestamp_cache_connect(sysdb, domain, upgrade_ctx);
913 *_ctx = talloc_steal(mem_ctx, sysdb);
933 struct sysdb_ctx *sysdb;
969 dom_upgrade_ctx, &sysdb);
978 ret = sysdb_chown_db_files(sysdb, uid, gid);
987 dom->sysdb = talloc_move(dom, &sysdb);