static TALLOC_CTX *cmdline_mem_ctx;
static struct loadparm_context *cmdline_lp_ctx;
+static struct cli_credentials *cmdline_creds;
/* PRIVATE */
bool samba_cmdline_set_talloc_ctx(TALLOC_CTX *mem_ctx)
{
return cmdline_lp_ctx;
}
+
+bool samba_cmdline_set_creds(struct cli_credentials *creds)
+{
+ if (creds == NULL) {
+ return false;
+ }
+
+ TALLOC_FREE(cmdline_creds);
+ cmdline_creds = creds;
+
+ return true;
+}
+
+struct cli_credentials *samba_cmdline_get_creds(void)
+{
+ return cmdline_creds;
+}
#ifndef _CMDLINE_H
#define _CMDLINE_H
+#include "auth/credentials/credentials.h"
+
/**
* @brief Initialize the commandline interface for parsing options.
*
*/
struct loadparm_context *samba_cmdline_get_lp_ctx(void);
+/**
+ * @brief Get the client credentials of the command line interface.
+ *
+ * @return A pointer to the client credentials.
+ */
+struct cli_credentials *samba_cmdline_get_creds(void);
+
#endif /* _CMDLINE_H */
*/
bool samba_cmdline_set_lp_ctx(struct loadparm_context *lp_ctx);
+/**
+ * @internal
+ *
+ * @brief Set the client credentials for the commandline interface.
+ *
+ * @param[in] creds The client credentials to use.
+ *
+ * @return true on success, false if an error occured.
+ */
+bool samba_cmdline_set_creds(struct cli_credentials *creds);
+
#endif /* _CMDLINE_PRIVATE_H */
#include "lib/util/debug.h"
#include "lib/util/fault.h"
#include "source3/param/loadparm.h"
+#include "auth/credentials/credentials.h"
#include "cmdline_private.h"
static bool _require_smbconf;
bool samba_cmdline_init(TALLOC_CTX *mem_ctx, bool require_smbconf)
{
struct loadparm_context *lp_ctx = NULL;
+ struct cli_credentials *creds = NULL;
bool ok;
ok = samba_cmdline_init_common(mem_ctx);
_require_smbconf = require_smbconf;
+ creds = cli_credentials_init(mem_ctx);
+ if (creds == NULL) {
+ return false;
+ }
+ ok = samba_cmdline_set_creds(creds);
+ if (!ok) {
+ return false;
+ }
+
return true;
}
#include "lib/param/param.h"
#include "lib/util/debug.h"
#include "lib/util/fault.h"
+#include "auth/credentials/credentials.h"
#include "cmdline_private.h"
static bool _require_smbconf;
bool samba_cmdline_init(TALLOC_CTX *mem_ctx, bool require_smbconf)
{
struct loadparm_context *lp_ctx = NULL;
+ struct cli_credentials *creds = NULL;
bool ok;
ok = samba_cmdline_init_common(mem_ctx);
}
_require_smbconf = require_smbconf;
+ creds = cli_credentials_init(mem_ctx);
+ if (creds == NULL) {
+ return false;
+ }
+ ok = samba_cmdline_set_creds(creds);
+ if (!ok) {
+ return false;
+ }
+
return true;
}
deps='''
talloc
samba-hostconfig
+ samba-credentials
popt
''',
private_library=True)