#define WB_VL_SOCKET_DIR "/run/systemd/userdb"
+static const char s_interface[] =
+"interface io.systemd.UserDatabase\n"
+""
+"method GetUserRecord("
+" uid: ?int,"
+" userName: ?string,"
+" service: string"
+") -> (record: object, incomplete: bool)\n"
+""
+"method GetGroupRecord("
+" gid: ?int,"
+" groupName: ?string,"
+" service: string"
+") -> (record: object, incomplete: bool)\n"
+""
+"method GetMemberships("
+" userName: ?string,"
+" groupName: ?string,"
+" service: string"
+") -> (userName: string, groupName: string)\n"
+""
+"error NoRecordFound ()\n"
+"error BadService ()\n"
+"error ServiceNotAvailable ()\n"
+"error ConflictingRecordFound ()\n"
+"error EnumerationNotSupported ()\n";
+
struct wb_vl_state {
VarlinkService *service;
struct tevent_context *ev_ctx;
int fd;
};
+static long io_systemd_getuserrecord(VarlinkService *service,
+ VarlinkCall *call,
+ VarlinkObject *parameters,
+ uint64_t flags,
+ void *userdata)
+{
+ return varlink_call_reply_error(call,
+ WB_VL_REPLY_ERROR_NO_RECORD_FOUND,
+ NULL);
+}
+
+static long io_systemd_getgrouprecord(VarlinkService *service,
+ VarlinkCall *call,
+ VarlinkObject *parameters,
+ uint64_t flags,
+ void *userdata)
+{
+ return varlink_call_reply_error(call,
+ WB_VL_REPLY_ERROR_NO_RECORD_FOUND,
+ NULL);
+}
+
+static long io_systemd_getmemberships(VarlinkService *service,
+ VarlinkCall *call,
+ VarlinkObject *parameters,
+ uint64_t flags,
+ void *userdata)
+{
+ return varlink_call_reply_error(call,
+ WB_VL_REPLY_ERROR_NO_RECORD_FOUND,
+ NULL);
+}
static void varlink_listen_fde_handler(struct tevent_context *ev,
struct tevent_fd *fde,
goto fail;
}
+ rc = varlink_service_add_interface(state->service, s_interface,
+ "GetUserRecord", io_systemd_getuserrecord, state,
+ "GetGroupRecord", io_systemd_getgrouprecord, state,
+ "GetMemberships", io_systemd_getmemberships, state,
+ NULL);
+ if (rc < 0) {
+ DBG_ERR("Failed to add Varlink interface: %s\n",
+ varlink_error_string(rc));
+ goto fail;
+ }
+
state->fd = varlink_service_get_fd(state->service);
if (state->fd < 0) {
DBG_ERR("Failed to get varlink fd: %s\n",
#define WB_VL_SERVICE_NAME "org.samba.winbind"
+#define WB_VL_REPLY_ERROR_NO_RECORD_FOUND \
+ "io.systemd.UserDatabase.NoRecordFound"
+#define WB_VL_REPLY_ERROR_BAD_SERVICE \
+ "io.systemd.UserDatabase.BadService"
+#define WB_VL_REPLY_ERROR_SERVICE_NOT_AVAILABLE \
+ "io.systemd.UserDatabase.ServiceNotAvailable"
+#define WB_VL_REPLY_ERROR_CONFLICTING_RECORD_FOUND \
+ "io.systemd.UserDatabase.ConflictingRecordFound"
+#define WB_VL_REPLY_ERROR_ENUMERATION_NOT_SUPPORTED \
+ "io.systemd.UserDatabase.EnumerationNotSupported"
+
+
bool winbind_setup_varlink(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx);
#endif /* _SOURCE3_WINBIND_VARLINK_H_ */