Skip to content

Commit

Permalink
Mark function md5() as deprecated and compile md5.c again
Browse files Browse the repository at this point in the history
Quote from issue #15:

> libcgi contains an implementation of the md5 hash function, however
> its not used inside the library itself and the status regarding
> license or potential security issues (despite the weekness of md5
> itself) is not clear. If a user needs md5 he or she could get it from
> a specialized library.

Although md5 is deprecated (#15) we can not simply remove the code from
the API. Do that later.

The HAVE_MD5 macro is useless, that was a relict from the old autotools
build and actually meant »build with md5«, so we can simply drop the
build time generated file and that macro.

Fixes: 0643151
Signed-off-by: Alexander Dahl <post@lespocky.de>
  • Loading branch information
LeSpocky committed Jul 19, 2018
1 parent c13110c commit b4a284c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
# Copyright 2013,2016,2018 Alexander Dahl <post@lespocky.de>
#

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
)

set(CGI_SRC
base64.c
cgi.c
cookie.c
error.c
general.c
list.c
# md5.c
md5.c
session.c
string.c
)
Expand Down
14 changes: 12 additions & 2 deletions src/cgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@

#include <stdio.h>

#if defined(__GNUC__)
#define CGI_DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define CGI_DEPRECATED __declspec(deprecated)
#elif defined(__clang__)
#define CGI_DEPRECATED __deprecated
#else
#pragma message("WARNING: You need to implement CGI_DEPRECATED for this compiler")
#define CGI_DEPRECATED
#endif

#ifdef __cplusplus
extern "C" {
#endif


// general purpose linked list. Actually isn't very portable
// because uses only 'name' and 'value' variables to store data.
// Problably, in a future release, this will be replaced by
Expand Down Expand Up @@ -81,7 +91,7 @@ extern char *stripslashes(char *str);
extern char *str_base64_encode(char *str);
extern char *str_base64_decode(char *str);
extern char *recvline(FILE *fp);
extern char *md5(const char *str);
CGI_DEPRECATED char *md5(const char *str);
extern char *cgi_ltrim(char *str);
extern char *cgi_rtrim(char *str);
extern char *cgi_trim(char *str);
Expand Down
1 change: 0 additions & 1 deletion src/config.h.cmake.in

This file was deleted.

4 changes: 0 additions & 4 deletions src/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@
#include <stdlib.h>
#include <string.h>

#include "config.h"
#include "error.h"
#include "cgi.h"

/** @ingroup libcgi_general
* @{
*/

#if HAVE_MD5

#ifndef MD5_H
#define MD5_H

Expand Down Expand Up @@ -95,7 +92,6 @@ char *md5(const char *str)
// returning a encrypted string
return tmp;
}
#endif

/*=======================================================================*/

Expand Down

0 comments on commit b4a284c

Please sign in to comment.