This file is indexed.

/usr/include/dacs/dsslib.h is in libdacs-dev 1.4.38a-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
 * Copyright (c) 2003-2015
 * Distributed Systems Software.  All rights reserved.
 * See the file LICENSE for redistribution information.
 *
 * $Id: dsslib.h 2796 2015-04-24 20:15:47Z brachman $
 */

#ifndef _DSSLIB_H_
#define _DSSLIB_H_

#include "dacs_config.h"

#include <sys/types.h>
#include <limits.h>
#include <string.h>

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>

/* Define this to get strptime() on some platforms */
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif

#include <time.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

/* Do not include DACS's local.h */
#include "ds.h"
#include "misc.h"
#include "str.h"
#include "range.h"
#include "kwv.h"
#include "net.h"
#include "http.h"
#include "cgiparse.h"
#include "mime.h"
#include "mkargv.h"
#include "http.h"
#include "xml.h"

/* For now, just make these functions go away... */
#define log_err(B)			log_exec_err B
#define log_msg(B)			log_exec_msg B
#define log_test(B)			0
#define log_would_log(LEV)	0

/* A lower numerical level means more verbose logging. */
typedef enum {
  LOG_TRACE_LEVEL    = 0,
  LOG_DEBUG_LEVEL    = 1,
  LOG_INFO_LEVEL     = 2,
  LOG_NOTICE_LEVEL   = 3,
  LOG_WARN_LEVEL     = 4,
  LOG_ERROR_LEVEL    = 5,
  LOG_CRITICAL_LEVEL = 6,
  LOG_ALERT_LEVEL    = 7,
  LOG_EMERG_LEVEL    = 8,
} Log_level;

#ifdef __cplusplus
extern "C" {
#endif

/* Need to provide this outside of loglib.c. */
static MAYBE_UNUSED Log_level
log_set_level(Log_level new_level)
{
  Log_level old_level;
  /* This is expected to be defined by the user. */
  extern Log_level current_log_level;

  old_level = current_log_level;
  current_log_level = new_level;

  return(old_level);
}

extern int log_exec_err(int level, char *fmt, ...);
extern int log_exec_msg(int level, char *fmt, ...);

#ifdef __cplusplus
}
#endif

#ifndef EAGAIN
#define EAGAIN  EWOULDBLOCK
#endif

#ifndef HAVE_IN_PORT_T
#ifdef HAVE_UINT16_T
/* See IEEE Std 1003.1, 2004 Edition. */
typedef uint16_t in_port_t;
#else
/* A guess. */
typedef unsigned short in_port_t;
#endif
#endif

enum {
  INIT_CGI_KWV = 10
};

static MAYBE_UNUSED char *
non_null(char *s)
{

  return((s != NULL) ? s : "");
}

static inline MAYBE_UNUSED void *
safe_inline_malloc(size_t size, const char *log_module_name)
{
  void *p;

  if ((p = malloc(size)) == NULL) {
	log_msg((LOG_ALERT_LEVEL, "malloc failed, exiting"));
	exit(1);
  }

  return(p);
}
#define safe_malloc(SIZE)		safe_inline_malloc(SIZE, log_module_name)

static inline MAYBE_UNUSED void
safe_free(void *ptr)
{
  free(ptr);
}

static inline MAYBE_UNUSED void *
safe_inline_calloc(size_t number, size_t size, const char *log_module_name)
{
  void *p;

  if ((p = calloc(number, size)) == NULL) {
	log_msg((LOG_ALERT_LEVEL, "calloc failed, exiting"));
	exit(1);
  }

  return(p);
}
#define safe_calloc(NUMBER, SIZE) \
		safe_inline_calloc(NUMBER, SIZE, log_module_name)

static inline MAYBE_UNUSED void *
safe_inline_realloc(void *ptr, size_t size, const char *log_module_name)
{
  void *p;

  if ((p = realloc(ptr, size)) == NULL) {
	log_msg((LOG_ALERT_LEVEL, "realloc failed, exiting"));
	exit(1);
  }
  return(p);
}
#define safe_realloc(PTR, SIZE)	\
	safe_inline_realloc(PTR, SIZE, log_module_name)

static inline MAYBE_UNUSED char *
safe_inline_strdup(const char *str, const char *log_module_name)
{
  size_t len;
  void *p;

  len = strlen(str) + 1;
  p = safe_malloc(len);
  memcpy(p, str, len);
  return((char *) p);
}
#define safe_strdup(STR)	safe_inline_strdup(STR, log_module_name)

#define malloc(X)		safe_malloc(X)
#define calloc(X, Y)	safe_calloc(X, Y)
#define free(X)			safe_free(X)
#define realloc(X, Y)	safe_realloc(X, Y)
#define reallocf(X, Y)	safe_realloc(X, Y)
#define strdup(X)		safe_strdup(X)

#define ALLOC(OBJ)			((OBJ *) malloc(sizeof(OBJ)))
#define ALLOC_N(OBJ, N)		((OBJ *) malloc(sizeof(OBJ) * (N)))

#define XMLNS_SEP_CHAR				'|'

#endif