From: David Disseldorp Date: Wed, 8 Feb 2017 16:26:14 +0000 (+0100) Subject: vfs_ceph: add user_id smb.conf parameter X-Git-Tag: talloc-2.1.9~147 X-Git-Url: http://git.samba.org/samba.git/?p=nivanova%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=ec788bead3118a8b9c6069c702357ea5509db868 vfs_ceph: add user_id smb.conf parameter The "ceph: user_id" parameter can be specified in smb.conf to explicitly set the Ceph client ID used when creating the mount handle. Signed-off-by: David Disseldorp Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 5cdb3723673..b74c2143e91 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -85,8 +85,9 @@ static int cephwrap_connect(struct vfs_handle_struct *handle, const char *servi { int ret; char buf[256]; - - const char * conf_file; + int snum = SNUM(handle->conn); + const char *conf_file; + const char *user_id; if (cmount) { handle->data = cmount; /* We have been here before */ @@ -94,28 +95,24 @@ static int cephwrap_connect(struct vfs_handle_struct *handle, const char *servi return 0; } - conf_file = lp_parm_const_string(SNUM(handle->conn), "ceph", "config_file", NULL); + /* if config_file and/or user_id are NULL, ceph will use defaults */ + conf_file = lp_parm_const_string(snum, "ceph", "config_file", NULL); + user_id = lp_parm_const_string(snum, "ceph", "user_id", NULL); - DBG_DEBUG( "[CEPH] calling: ceph_create\n" ); - ret = ceph_create(&cmount, NULL); - if (ret) + DBG_DEBUG("[CEPH] calling: ceph_create\n"); + ret = ceph_create(&cmount, user_id); + if (ret) { goto err_out; - - if (conf_file) { - /* Override the config file */ - DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file\n" ); - ret = ceph_conf_read_file(cmount, conf_file); - } else { - - DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file with %s\n", conf_file); - ret = ceph_conf_read_file(cmount, NULL); } + DBG_DEBUG("[CEPH] calling: ceph_conf_read_file with %s\n", + (conf_file == NULL ? "default path" : conf_file)); + ret = ceph_conf_read_file(cmount, conf_file); if (ret) { goto err_cm_release; } - DBG_DEBUG( "[CEPH] calling: ceph_conf_get\n" ); + DBG_DEBUG("[CEPH] calling: ceph_conf_get\n"); ret = ceph_conf_get(cmount, "log file", buf, sizeof(buf)); if (ret < 0) { goto err_cm_release;