From: Michael Adam Date: Wed, 9 Apr 2008 13:16:45 +0000 (+0200) Subject: libsmbconf: fix crashbug - correctly check for existence of file. X-Git-Tag: samba-3.3.0pre1~2781 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd543cd30c3eca9621681ba4b6e9a6683ef2bd07;p=thirdparty%2Fsamba.git libsmbconf: fix crashbug - correctly check for existence of file. Michael --- diff --git a/source/lib/smbconf/smbconf_txt_simple.c b/source/lib/smbconf/smbconf_txt_simple.c index 2183ac3bec8..9164d1690a9 100644 --- a/source/lib/smbconf/smbconf_txt_simple.c +++ b/source/lib/smbconf/smbconf_txt_simple.c @@ -175,8 +175,13 @@ static WERROR smbconf_txt_init_cache(struct smbconf_ctx *ctx) static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx) { WERROR werr; - uint64_t new_csn = (uint64_t)file_modtime(ctx->path); + uint64_t new_csn; + if (!file_exist(ctx->path, NULL)) { + return WERR_BADFILE; + } + + new_csn = (uint64_t)file_modtime(ctx->path); if (new_csn == pd(ctx)->csn) { return WERR_OK; }