From cb615bfbb4f5d1d8db561462e6fd993498ebb15b Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Mon, 20 Nov 2006 19:07:25 +0000 Subject: [PATCH] Add. --- gl/override/doc/gpl.texi.diff | 17 ++++++++ gl/override/doc/lgpl.texi.diff | 15 +++++++ gl/override/lgpl.texi.diff | 15 +++++++ lib/gs2/gs2wrap.c | 93 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 gl/override/doc/gpl.texi.diff create mode 100644 gl/override/doc/lgpl.texi.diff create mode 100644 gl/override/lgpl.texi.diff create mode 100644 lib/gs2/gs2wrap.c diff --git a/gl/override/doc/gpl.texi.diff b/gl/override/doc/gpl.texi.diff new file mode 100644 index 0000000..5e52212 --- /dev/null +++ b/gl/override/doc/gpl.texi.diff @@ -0,0 +1,17 @@ +Index: gpl.texi +=================================================================== +RCS file: /sources/gnulib/gnulib/doc/gpl.texi,v +retrieving revision 1.6 +diff -u -p -r1.6 gpl.texi +--- gpl.texi 17 Sep 2006 22:00:25 -0000 1.6 ++++ gpl.texi 21 Sep 2006 13:24:46 -0000 +@@ -1,6 +1,7 @@ +-@node Copying +-@unnumbered GNU General Public License ++@node GNU GPL ++@appendixsec GNU General Public License + @cindex GPL, GNU General Public License ++@cindex License, GNU GPL + @center Version 2, June 1991 + + @c This file is intended to be included in another file. diff --git a/gl/override/doc/lgpl.texi.diff b/gl/override/doc/lgpl.texi.diff new file mode 100644 index 0000000..cba9ee7 --- /dev/null +++ b/gl/override/doc/lgpl.texi.diff @@ -0,0 +1,15 @@ +Index: lgpl.texi +=================================================================== +RCS file: /sources/gnulib/gnulib/doc/lgpl.texi,v +retrieving revision 1.5 +diff -u -p -r1.5 lgpl.texi +--- lgpl.texi 16 Sep 2006 14:04:29 -0000 1.5 ++++ lgpl.texi 21 Sep 2006 13:24:56 -0000 +@@ -1,6 +1,7 @@ + @node GNU LGPL + @appendixsec GNU Lesser General Public License + @cindex LGPL, GNU Lesser General Public License ++@cindex License, GNU LGPL + @center Version 2.1, February 1999 + + @display diff --git a/gl/override/lgpl.texi.diff b/gl/override/lgpl.texi.diff new file mode 100644 index 0000000..cba9ee7 --- /dev/null +++ b/gl/override/lgpl.texi.diff @@ -0,0 +1,15 @@ +Index: lgpl.texi +=================================================================== +RCS file: /sources/gnulib/gnulib/doc/lgpl.texi,v +retrieving revision 1.5 +diff -u -p -r1.5 lgpl.texi +--- lgpl.texi 16 Sep 2006 14:04:29 -0000 1.5 ++++ lgpl.texi 21 Sep 2006 13:24:56 -0000 +@@ -1,6 +1,7 @@ + @node GNU LGPL + @appendixsec GNU Lesser General Public License + @cindex LGPL, GNU Lesser General Public License ++@cindex License, GNU LGPL + @center Version 2.1, February 1999 + + @display diff --git a/lib/gs2/gs2wrap.c b/lib/gs2/gs2wrap.c new file mode 100644 index 0000000..16678c1 --- /dev/null +++ b/lib/gs2/gs2wrap.c @@ -0,0 +1,93 @@ +/* gs2parser.h --- GS2 parser. + * Copyright (C) 2006 Simon Josefsson + * + * This file is part of GNU SASL Library. + * + * GNU SASL Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * GNU SASL Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GNU SASL Library; if not, write to the Free + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "gs2parser.h" + +#include + +/* + * + * 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | client_qops | client_maxbuf | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | channel_binding_length | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * |[client_cbqops]| [channel_binding_data] / + * / / + * / / [authzid] / + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + */ +int +gs2_parse_request (const char *request, size_t reqlen, + int clientp, + int *qop, size_t *maxbuf, size_t *cblen, + int *cbqops, char **cbdata, char **authzid) +{ + size_t l; + + if (reqlen < 8) + return -1; + + if (qop) + *qop = request[0]; + + if (maxbuf) + *maxbuf = + (request[1] << 16) & 0xFF0000 | + (request[2] << 8) & 0xFF00 | + (request[3]) & 0xFF; + + l = (request[4] << 24) & 0xFF000000 | + (request[5] << 16) & 0xFF0000 | + (request[6] << 8) & 0xFF00 | + (request[7]) & 0xFF; + + if (l > 0 && reqlen == 8) + return -2; + + if (cblen) + *cblen = l; + + if (l > 0) + { + if (cbqops) + *cbqops = request[8]; + if (cbdata) + *cbdata = &request[9]; + if (authzid) + *authzid = &request[9] + l; + } + else + { + if (cbqops) + *cbqops = 0; + if (cbdata) + *cbdata = NULL; + if (authzid) + *authzid = NULL; + } + + return 0; +} -- 2.11.4.GIT