1295367Sdes/* $Id: bsd-cygwin_util.h,v 1.18 2014/05/27 04:34:43 djm Exp $ */ 298937Sdes 398937Sdes/* 4250739Sdes * Copyright (c) 2000, 2001, 2011, 2013 Corinna Vinschen <vinschen@redhat.com> 598937Sdes * 698937Sdes * Redistribution and use in source and binary forms, with or without 798937Sdes * modification, are permitted provided that the following conditions 898937Sdes * are met: 998937Sdes * 1. Redistributions of source code must retain the above copyright 1098937Sdes * notice, this list of conditions and the following disclaimer. 1198937Sdes * 2. Redistributions in binary form must reproduce the above copyright 1298937Sdes * notice, this list of conditions and the following disclaimer in the 1398937Sdes * documentation and/or other materials provided with the distribution. 1498937Sdes * 1598937Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1698937Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1798937Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1898937Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1998937Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2098937Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2198937Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2298937Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2398937Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2498937Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2598937Sdes * 2698937Sdes * Created: Sat Sep 02 12:17:00 2000 cv 2798937Sdes * 2898937Sdes * This file contains functions for forcing opened file descriptors to 2998937Sdes * binary mode on Windows systems. 3098937Sdes */ 3198937Sdes 3298937Sdes#ifndef _BSD_CYGWIN_UTIL_H 3398937Sdes#define _BSD_CYGWIN_UTIL_H 3498937Sdes 3598937Sdes#ifdef HAVE_CYGWIN 3698937Sdes 37124208Sdes#undef ERROR 38124208Sdes 39250739Sdes/* Avoid including windows headers. */ 40250739Sdestypedef void *HANDLE; 41250739Sdes#define INVALID_HANDLE_VALUE ((HANDLE) -1) 42295367Sdes#define DNLEN 16 43295367Sdes#define UNLEN 256 44240075Sdes 45262566Sdes/* Cygwin functions for which declarations are only available when including 46262566Sdes windows headers, so we have to define them here explicitely. */ 47262566Sdesextern HANDLE cygwin_logon_user (const struct passwd *, const char *); 48262566Sdesextern void cygwin_set_impersonation_token (const HANDLE); 49262566Sdes 50124208Sdes#include <sys/cygwin.h> 5198937Sdes#include <io.h> 5298937Sdes 53295367Sdes#define CYGWIN_SSH_PRIVSEP_USER (cygwin_ssh_privsep_user()) 54295367Sdesconst char *cygwin_ssh_privsep_user(); 55262566Sdes 56124208Sdesint binary_open(const char *, int , ...); 57124208Sdesint check_ntsec(const char *); 58146998Sdeschar **fetch_windows_environment(void); 59146998Sdesvoid free_windows_environment(char **); 6098937Sdes 61250739Sdes#ifndef NO_BINARY_OPEN 6298937Sdes#define open binary_open 63250739Sdes#endif 6498937Sdes 6598937Sdes#endif /* HAVE_CYGWIN */ 6698937Sdes 6798937Sdes#endif /* _BSD_CYGWIN_UTIL_H */ 68