# [PATCH v3] credential-osxkeychain: support more protocols

2 messages from 2013-05-31 to 2013-06-02. Participants: Xidorn Quan, Junio C Hamano.
Thread: https://gitlist.dev/t/33997

## Xidorn Quan, 2013-05-31 04:07

Subject: [PATCH v3] credential-osxkeychain: support more protocols
Message-ID: <1369973275-13353-1-git-send-email-quanxunzhen@gmail.com>
URL: https://gitlist.dev/e/1369973275-13353-1-git-send-email-quanxunzhen%40gmail.com

```
Add protocol imap, imaps, ftp and smtp for credential-osxkeychain.

Signed-off-by: Xidorn Quan <quanxunzhen@gmail.com>
Acked-by: John Szakmeister <john@szakmeister.net>
Acked-by: Jeff King <peff@peff.net>
---
 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 3940202..bcd3f57 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -127,10 +127,20 @@ static void read_credential(void)
 		*v++ = '\0';
 
 		if (!strcmp(buf, "protocol")) {
-			if (!strcmp(v, "https"))
+			if (!strcmp(v, "imap"))
+				protocol = kSecProtocolTypeIMAP;
+			else if (!strcmp(v, "imaps"))
+				protocol = kSecProtocolTypeIMAPS;
+			else if (!strcmp(v, "ftp"))
+				protocol = kSecProtocolTypeFTP;
+			else if (!strcmp(v, "ftps"))
+				protocol = kSecProtocolTypeFTPS;
+			else if (!strcmp(v, "https"))
 				protocol = kSecProtocolTypeHTTPS;
 			else if (!strcmp(v, "http"))
 				protocol = kSecProtocolTypeHTTP;
+			else if (!strcmp(v, "smtp"))
+				protocol = kSecProtocolTypeSMTP;
 			else /* we don't yet handle other protocols */
 				exit(0);
 		}
-- 
1.8.3

```

## Junio C Hamano, 2013-06-02 19:46

Subject: Re: [PATCH v3] credential-osxkeychain: support more protocols
Message-ID: <7vbo7onvmn.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbo7onvmn.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1369973275-13353-1-git-send-email-quanxunzhen@gmail.com>

```
Xidorn Quan <quanxunzhen@gmail.com> writes:

> Add protocol imap, imaps, ftp and smtp for credential-osxkeychain.
>
> Signed-off-by: Xidorn Quan <quanxunzhen@gmail.com>
> Acked-by: John Szakmeister <john@szakmeister.net>
> Acked-by: Jeff King <peff@peff.net>
> ---

Hmph, I think I already have an identical copy in my tree.  Sent a
wrong patch?

>  contrib/credential/osxkeychain/git-credential-osxkeychain.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> index 3940202..bcd3f57 100644
> --- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> +++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> @@ -127,10 +127,20 @@ static void read_credential(void)
>  		*v++ = '\0';
>  
>  		if (!strcmp(buf, "protocol")) {
> -			if (!strcmp(v, "https"))
> +			if (!strcmp(v, "imap"))
> +				protocol = kSecProtocolTypeIMAP;
> +			else if (!strcmp(v, "imaps"))
> +				protocol = kSecProtocolTypeIMAPS;
> +			else if (!strcmp(v, "ftp"))
> +				protocol = kSecProtocolTypeFTP;
> +			else if (!strcmp(v, "ftps"))
> +				protocol = kSecProtocolTypeFTPS;
> +			else if (!strcmp(v, "https"))
>  				protocol = kSecProtocolTypeHTTPS;
>  			else if (!strcmp(v, "http"))
>  				protocol = kSecProtocolTypeHTTP;
> +			else if (!strcmp(v, "smtp"))
> +				protocol = kSecProtocolTypeSMTP;
>  			else /* we don't yet handle other protocols */
>  				exit(0);
>  		}

```
