Blame modules/pam_console/regerr.c

Packit 7e982e
/* Copyright 1999 Red Hat Software, Inc.
Packit 7e982e
 * This software may be used under the terms of the GNU General Public
Packit 7e982e
 * License, available in the file COPYING accompanying this file
Packit 7e982e
 */
Packit 7e982e
#include "config.h"
Packit 7e982e
#include <stdio.h>
Packit 7e982e
#include <alloca.h>
Packit 7e982e
#include <sys/types.h>
Packit 7e982e
#include <syslog.h>
Packit 7e982e
#include <security/pam_ext.h>
Packit 7e982e
#include "pam_console.h"
Packit 7e982e
Packit 7e982e
#ifndef STATIC
Packit 7e982e
#define STATIC
Packit 7e982e
#endif
Packit 7e982e
Packit 7e982e
STATIC void
Packit 7e982e
do_regerror(int errcode, const regex_t *preg) {
Packit 7e982e
    char *errbuf;
Packit 7e982e
    size_t errbuf_size;
Packit 7e982e
Packit 7e982e
    errbuf_size = regerror(errcode, preg, NULL, 0); /* missing ; */
Packit 7e982e
    errbuf = alloca(errbuf_size);
Packit 7e982e
    if(!errbuf) {
Packit 7e982e
	perror("alloca");
Packit 7e982e
	return;
Packit 7e982e
    }
Packit 7e982e
Packit 7e982e
    regerror(errcode, preg, errbuf, errbuf_size);
Packit 7e982e
    pam_syslog(NULL, LOG_ERR,
Packit 7e982e
	     "regular expression error %s", errbuf);
Packit 7e982e
}