From patchwork Thu Jan 24 18:34:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 215468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "userp1040.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E873B2C009B for ; Fri, 25 Jan 2013 05:35:05 +1100 (EST) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0OIZ2uF013633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jan 2013 18:35:02 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0OIZ12X002409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Jan 2013 18:35:01 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TyRdd-0000OP-IK; Thu, 24 Jan 2013 10:35:01 -0800 Received: from acsinet21.oracle.com ([141.146.126.237]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TyRdS-0000Nn-Cu for fedfs-utils-devel@oss.oracle.com; Thu, 24 Jan 2013 10:34:50 -0800 Received: from aserp1020.oracle.com (aserp1020.oracle.com [141.146.126.67]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0OIYowQ001924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Jan 2013 18:34:50 GMT Received: from mail-ie0-f176.google.com (mail-ie0-f176.google.com [209.85.223.176]) by aserp1020.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0OIYndW002211 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 24 Jan 2013 18:34:49 GMT Received: by mail-ie0-f176.google.com with SMTP id 13so3964iea.7 for ; Thu, 24 Jan 2013 10:34:48 -0800 (PST) X-Received: by 10.42.18.138 with SMTP id x10mr1850129ica.22.1359052488659; Thu, 24 Jan 2013 10:34:48 -0800 (PST) Received: from seurat.1015granger.net ([99.26.161.222]) by mx.google.com with ESMTPS id u4sm1857383igw.6.2013.01.24.10.34.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Jan 2013 10:34:48 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Thu, 24 Jan 2013 13:34:47 -0500 Message-ID: <20130124183446.13601.64549.stgit@seurat.1015granger.net> In-Reply-To: <20130124182619.13601.61251.stgit@seurat.1015granger.net> References: <20130124182619.13601.61251.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Flow-Control-Info: class=Default reputation=ipRepBelow100 ip=209.85.223.176 ct-class=R5 ct-vol1=-99 ct-vol2=8 ct-vol3=8 ct-risk=50 ct-spam1=82 ct-spam2=6 ct-bulk=5 rcpts=1 size=7614 X-MM-CT-Classification: not spam X-MM-CT-RefID: str=0001.0A090206.51017EC9.00F7,ss=1,re=0.000,fgs=0 Subject: [fedfs-utils] [PATCH 02/11] libnsdb: nsdb_bind() returns incorrect error code X-BeenThere: fedfs-utils-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: fedfs-utils Developers List-Id: fedfs-utils Developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] FEDFS_ERR_NSDB_AUTH means our NSDB client could not authenticate the NSDB. That authentication is done with an x.509 certificate. A user-provided password plays no part. A missing password is a user input error, thus FEDFS_ERR_INVAL is the correct error return. Signed-off-by: Chuck Lever --- src/libnsdb/ldap.c | 2 +- src/nfsref/add.c | 3 +++ src/nfsref/remove.c | 3 +++ src/nsdbc/nsdb-annotate.c | 3 +++ src/nsdbc/nsdb-create-fsl.c | 3 +++ src/nsdbc/nsdb-create-fsn.c | 3 +++ src/nsdbc/nsdb-delete-fsl.c | 3 +++ src/nsdbc/nsdb-delete-fsn.c | 3 +++ src/nsdbc/nsdb-delete-nsdb.c | 3 +++ src/nsdbc/nsdb-describe.c | 3 +++ src/nsdbc/nsdb-remove-nci.c | 3 +++ src/nsdbc/nsdb-simple-nce.c | 3 +++ src/nsdbc/nsdb-update-fsl.c | 3 +++ src/nsdbc/nsdb-update-nci.c | 3 +++ 14 files changed, 40 insertions(+), 1 deletions(-) diff --git a/src/libnsdb/ldap.c b/src/libnsdb/ldap.c index 7f001a0..cbd56b6 100644 --- a/src/libnsdb/ldap.c +++ b/src/libnsdb/ldap.c @@ -562,7 +562,7 @@ nsdb_bind(LDAP *ld, const char *binddn, const char *passwd, secret = nsdb_get_pw(); if (secret == NULL) { xlog(D_GENERAL, "No password provided"); - return FEDFS_ERR_NSDB_AUTH; + return FEDFS_ERR_INVAL; } } diff --git a/src/nfsref/add.c b/src/nfsref/add.c index cd126d4..c99e2a1 100644 --- a/src/nfsref/add.c +++ b/src/nfsref/add.c @@ -604,6 +604,9 @@ nfsref_add_nfs_fedfs(const char *junct_path, char **argv, int optind) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + xlog(L_ERROR, "Missing or invalid password"); + goto out_free; case FEDFS_ERR_NSDB_CONN: xlog(L_ERROR, "Failed to connect to NSDB %s:%u", nsdbname, nsdbport); diff --git a/src/nfsref/remove.c b/src/nfsref/remove.c index 8f2f5d0..c40d6dc 100644 --- a/src/nfsref/remove.c +++ b/src/nfsref/remove.c @@ -179,6 +179,9 @@ nfsref_remove_delete_fsn(const char *junct_path) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + xlog(L_ERROR, "Missing or invalid password"); + goto out_free; case FEDFS_ERR_NSDB_CONN: xlog(L_ERROR, "Failed to connect to NSDB %s:%u", nsdb_hostname(host), nsdb_port(host)); diff --git a/src/nsdbc/nsdb-annotate.c b/src/nsdbc/nsdb-annotate.c index ddc3c14..bd8d6c4 100644 --- a/src/nsdbc/nsdb-annotate.c +++ b/src/nsdbc/nsdb-annotate.c @@ -254,6 +254,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-create-fsl.c b/src/nsdbc/nsdb-create-fsl.c index d856175..4089193 100644 --- a/src/nsdbc/nsdb-create-fsl.c +++ b/src/nsdbc/nsdb-create-fsl.c @@ -257,6 +257,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-create-fsn.c b/src/nsdbc/nsdb-create-fsn.c index 6e4d9bc..655f0c6 100644 --- a/src/nsdbc/nsdb-create-fsn.c +++ b/src/nsdbc/nsdb-create-fsn.c @@ -234,6 +234,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-delete-fsl.c b/src/nsdbc/nsdb-delete-fsl.c index cad6d17..1c45da4 100644 --- a/src/nsdbc/nsdb-delete-fsl.c +++ b/src/nsdbc/nsdb-delete-fsl.c @@ -216,6 +216,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-delete-fsn.c b/src/nsdbc/nsdb-delete-fsn.c index 8f88d01..af06a89 100644 --- a/src/nsdbc/nsdb-delete-fsn.c +++ b/src/nsdbc/nsdb-delete-fsn.c @@ -218,6 +218,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-delete-nsdb.c b/src/nsdbc/nsdb-delete-nsdb.c index 27f5ae4..b959057 100644 --- a/src/nsdbc/nsdb-delete-nsdb.c +++ b/src/nsdbc/nsdb-delete-nsdb.c @@ -191,6 +191,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-describe.c b/src/nsdbc/nsdb-describe.c index a76f82a..4480786 100644 --- a/src/nsdbc/nsdb-describe.c +++ b/src/nsdbc/nsdb-describe.c @@ -211,6 +211,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-remove-nci.c b/src/nsdbc/nsdb-remove-nci.c index 9ce9775..71f832e 100644 --- a/src/nsdbc/nsdb-remove-nci.c +++ b/src/nsdbc/nsdb-remove-nci.c @@ -186,6 +186,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-simple-nce.c b/src/nsdbc/nsdb-simple-nce.c index 8423295..dfc0cb1 100644 --- a/src/nsdbc/nsdb-simple-nce.c +++ b/src/nsdbc/nsdb-simple-nce.c @@ -186,6 +186,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-update-fsl.c b/src/nsdbc/nsdb-update-fsl.c index 5427be3..d5b13cd 100644 --- a/src/nsdbc/nsdb-update-fsl.c +++ b/src/nsdbc/nsdb-update-fsl.c @@ -227,6 +227,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport); diff --git a/src/nsdbc/nsdb-update-nci.c b/src/nsdbc/nsdb-update-nci.c index e210d82..5277356 100644 --- a/src/nsdbc/nsdb-update-nci.c +++ b/src/nsdbc/nsdb-update-nci.c @@ -194,6 +194,9 @@ main(int argc, char **argv) switch (retval) { case FEDFS_OK: break; + case FEDFS_ERR_INVAL: + fprintf(stderr, "Missing or invalid password\n"); + goto out_free; case FEDFS_ERR_NSDB_CONN: fprintf(stderr, "Failed to connect to NSDB %s:%u\n", nsdbname, nsdbport);