From patchwork Thu Jul 5 13:29:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wido den Hollander X-Patchwork-Id: 1160731 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9B7733FE4F for ; Thu, 5 Jul 2012 13:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755731Ab2GENaA (ORCPT ); Thu, 5 Jul 2012 09:30:00 -0400 Received: from smtp02.mail.pcextreme.nl ([109.72.87.138]:35473 "EHLO smtp02.mail.pcextreme.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754552Ab2GEN37 (ORCPT ); Thu, 5 Jul 2012 09:29:59 -0400 Received: from amd.ceph.widodh.nl (amd.ceph.widodh.nl [31.25.100.162]) by smtp02.mail.pcextreme.nl (Postfix) with ESMTPA id 8C6A840336; Thu, 5 Jul 2012 15:29:57 +0200 (CEST) From: Wido den Hollander To: ceph-devel@vger.kernel.org Cc: Wido den Hollander Subject: [PATCH] Allow URL-safe base64 cephx keys to be decoded. Date: Thu, 5 Jul 2012 15:29:54 +0200 Message-Id: <1341494994-32002-1-git-send-email-wido@widodh.nl> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <67103350.513LE7Wbhg@linuix> References: <67103350.513LE7Wbhg@linuix> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org In these cases + and / are replaced by - and _ to prevent problems when using the base64 strings in URLs. Signed-off-by: Wido den Hollander --- src/common/armor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/armor.c b/src/common/armor.c index d1d5664..e4b8b86 100644 --- a/src/common/armor.c +++ b/src/common/armor.c @@ -24,9 +24,9 @@ static int decode_bits(char c) return c - 'a' + 26; if (c >= '0' && c <= '9') return c - '0' + 52; - if (c == '+') + if (c == '+' || c == '-') return 62; - if (c == '/') + if (c == '/' || c == '_') return 63; if (c == '=') return 0; /* just non-negative, please */