#include "shadowlog.h"
#include "string/sprintf/xasprintf.h"
#include "string/strcmp/streq.h"
+#include "string/strcmp/strprefix.h"
static /*@null@*/const char *src_orig;
* create a link to the corresponding entry in the dst_orig
* directory.
*/
- if (strncmp(oldlink, src_orig, strlen(src_orig)) == 0) {
+ if (strprefix(oldlink, src_orig)) {
char *dummy;
xasprintf(&dummy, "%s%s", dst_orig, oldlink + strlen(src_orig));
#include "shadowlog.h"
#include "string/sprintf/snprintf.h"
#include "string/sprintf/xasprintf.h"
+#include "string/strcmp/strprefix.h"
#include "string/strdup/xstrdup.h"
const char *const *p;
for (p = forbid; NULL != *p; p++) {
- if (strncmp (*argv, *p, strlen (*p)) == 0) {
+ if (strprefix(*argv, *p)) {
break;
}
}
for (cur = envp; NULL != *cur; cur++) {
for (bad = forbid; NULL != *bad; bad++) {
- if (strncmp (*cur, *bad, strlen (*bad)) == 0) {
+ if (strprefix(*cur, *bad)) {
for (move = cur; NULL != *move; move++) {
*move = *(move + 1);
}
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+
#include "defines.h"
-#include "prototypes.h"
-#include "subordinateio.h"
#include "getdef.h"
#include "idmapping.h"
+#include "prototypes.h"
#include "shadowlog.h"
+#include "string/strcmp/strprefix.h"
+#include "subordinateio.h"
+
/*
* Global variables
strerror(errno));
exit(EXIT_FAILURE);
}
- if (!strncmp(policy_buffer, policy, strlen(policy)))
+ if (strprefix(policy_buffer, policy))
goto out;
/* Write the policy. */
#include "shadowlog.h"
#include "string/sprintf/xasprintf.h"
#include "string/strcmp/streq.h"
+#include "string/strcmp/strprefix.h"
#include "string/strdup/xstrdup.h"
#ifdef EXTRA_CHECK_HOME_DIR
static bool path_prefix (const char *s1, const char *s2)
{
- return ( (strncmp (s2, s1, strlen (s1)) == 0)
+ return ( strprefix(s2, s1)
&& ( ('\0' == s2[strlen (s1)])
|| ('/' == s2[strlen (s1)])));
}