gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS gsasl/lib/src


From: gsasl-commit
Subject: CVS gsasl/lib/src
Date: Tue, 30 Nov 2004 03:12:00 +0100

Update of /home/cvs/gsasl/lib/src
In directory dopio:/tmp/cvs-serv2534

Added Files:
        saslprep.c 
Log Message:
New file.



--- /home/cvs/gsasl/lib/src/saslprep.c  2004/11/30 02:12:00     NONE
+++ /home/cvs/gsasl/lib/src/saslprep.c  2004/11/30 02:12:00     1.1
/* saslprep.c --- Internationalized SASL string processing.
 * Copyright (C) 2002, 2003, 2004  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
 * License along with GNU SASL Library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "internal.h"

#if WITH_STRINGPREP
# include <stringprep.h>
#endif

/**
 * gsasl_saslprep:
 * @in: a UTF-8 encoded string.
 * @allowunassigned: whether to allow unassigned code points in the output.
 * @out: on exit, contains newly allocated output string.
 *
 * Prepare string using SASLprep.  On success, the @out variable must
 * be deallocated by the caller.
 *
 * Return value: Returns %GSASL_OK on success, or
 * %GSASL_SASLPREP_ERROR on error.
 *
 * Since: 0.2.3
 **/
int
gsasl_saslprep (const char *in, int allowunassigned, char **out)
{
#if WITH_STRINGPREP
  int rc;

  rc = stringprep_profile (in, out, "SASLprep",
                           allowunassigned ? STRINGPREP_NO_UNASSIGNED : 0);
  if (rc != STRINGPREP_OK)
    {
      *out = NULL;
      return GSASL_SASLPREP_ERROR;
    }

  return GSASL_OK;
#else
  return GSASL_SASLPREP_ERROR;
#endif
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]