mirror of
https://github.com/samba-team/samba.git
synced 2025-08-29 13:49:30 +03:00
r1472: Make mknod work again for the CIFS client. Still needs some
client changes. With this, storing home directories on a Samba
share that require unix domain socket entries should work.
Jeremy.
(This used to be commit da943b5b72
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
8ef0682954
commit
f9e72f1a41
@ -643,7 +643,7 @@ AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/i
|
||||
AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
|
||||
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
|
||||
AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
|
||||
AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
|
||||
AC_CHECK_HEADERS(sys/sysmacros.h security/pam_modules.h security/_pam_macros.h dlfcn.h)
|
||||
AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h)
|
||||
AC_CHECK_HEADERS(langinfo.h locale.h)
|
||||
|
||||
@ -1429,6 +1429,18 @@ if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
|
||||
AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for makedev macro],samba_cv_HAVE_MAKEDEV,[
|
||||
AC_TRY_RUN([
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
main() { dev_t dev = makedev(1,2); return 0; }],
|
||||
samba_cv_HAVE_MAKEDEV=yes,samba_cv_HAVE_MAKEDEV=no,samba_cv_HAVE_MAKEDEV=cross)])
|
||||
if test x"$samba_cv_HAVE_MAKEDEV" = x"yes"; then
|
||||
AC_DEFINE(HAVE_MAKEDEV,1,[Whether the macro for makedev is available])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
|
||||
AC_TRY_RUN([#include <stdio.h>
|
||||
main() { char c; c=250; exit((c > 0)?0:1); }],
|
||||
|
@ -3358,16 +3358,15 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
|
||||
* a new info level should be used for mknod. JRA.
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_MAKEDEV_FN)
|
||||
return(ERROR_DOS(ERRDOS,ERRnoaccess));
|
||||
#else /* HAVE_MAKEDEV_FN */
|
||||
uint32 file_type = IVAL(pdata,0);
|
||||
#if defined(HAVE_MAKEDEV)
|
||||
uint32 dev_major = IVAL(pdata,4);
|
||||
uint32 dev_minor = IVAL(pdata,12);
|
||||
#endif
|
||||
|
||||
uid_t myuid = geteuid();
|
||||
gid_t mygid = getegid();
|
||||
SMB_DEV_T dev;
|
||||
SMB_DEV_T dev = (SMB_DEV_T)0;
|
||||
|
||||
if (tran_call == TRANSACT2_SETFILEINFO)
|
||||
return(ERROR_DOS(ERRDOS,ERRnoaccess));
|
||||
@ -3375,7 +3374,9 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
|
||||
if (raw_unixmode == SMB_MODE_NO_CHANGE)
|
||||
return(ERROR_DOS(ERRDOS,ERRinvalidparam));
|
||||
|
||||
#if defined(HAVE_MAKEDEV)
|
||||
dev = makedev(dev_major, dev_minor);
|
||||
#endif
|
||||
|
||||
/* We can only create as the owner/group we are. */
|
||||
|
||||
@ -3384,10 +3385,30 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
|
||||
if ((set_grp != mygid) && (set_grp != (gid_t)SMB_GID_NO_CHANGE))
|
||||
return(ERROR_DOS(ERRDOS,ERRnoaccess));
|
||||
|
||||
if (file_type != UNIX_TYPE_CHARDEV && file_type != UNIX_TYPE_BLKDEV &&
|
||||
file_type != UNIX_TYPE_FIFO &&
|
||||
file_type != UNIX_TYPE_SOCKET)
|
||||
return(ERROR_DOS(ERRDOS,ERRnoaccess));
|
||||
switch (file_type) {
|
||||
#if defined(S_IFIFO)
|
||||
case UNIX_TYPE_FIFO:
|
||||
unixmode |= S_IFIFO;
|
||||
break;
|
||||
#endif
|
||||
#if defined(S_IFSOCK)
|
||||
case UNIX_TYPE_SOCKET:
|
||||
unixmode |= S_IFSOCK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(S_IFCHR)
|
||||
case UNIX_TYPE_CHARDEV:
|
||||
unixmode |= S_IFCHR;
|
||||
break;
|
||||
#endif
|
||||
#if defined(S_IFBLK)
|
||||
case UNIX_TYPE_BLKDEV:
|
||||
unixmode |= S_IFBLK;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return(ERROR_DOS(ERRDOS,ERRnoaccess));
|
||||
}
|
||||
|
||||
DEBUG(10,("call_trans2setfilepathinfo: SMB_SET_FILE_UNIX_BASIC doing mknod dev %.0f mode \
|
||||
0%o for file %s\n", (double)dev, unixmode, fname ));
|
||||
@ -3401,8 +3422,6 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
|
||||
SSVAL(params,0,0);
|
||||
send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
|
||||
return(-1);
|
||||
#endif /* HAVE_MAKEDEV_FN */
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user