1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _OSL_SECURITY_H_ 29*cdf0e10cSrcweir #define _OSL_SECURITY_H_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <rtl/ustring.h> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #ifdef __cplusplus 34*cdf0e10cSrcweir extern "C" { 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir typedef enum { 38*cdf0e10cSrcweir osl_Security_E_None, 39*cdf0e10cSrcweir osl_Security_E_UserUnknown, 40*cdf0e10cSrcweir osl_Security_E_WrongPassword, 41*cdf0e10cSrcweir osl_Security_E_Unknown, 42*cdf0e10cSrcweir osl_Security_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 43*cdf0e10cSrcweir } oslSecurityError; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir /** Process handle 46*cdf0e10cSrcweir @see osl_loginUser 47*cdf0e10cSrcweir @see osl_freeSecurityHandle 48*cdf0e10cSrcweir @see osl_executeProcess 49*cdf0e10cSrcweir */ 50*cdf0e10cSrcweir typedef void* oslSecurity; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir /** Create a security handle for the current user. 53*cdf0e10cSrcweir @return a security handle or NULL on failure. 54*cdf0e10cSrcweir @see osl_freeSecurityHandle 55*cdf0e10cSrcweir @see osl_executeProcess 56*cdf0e10cSrcweir @see osl_executeApplication 57*cdf0e10cSrcweir */ 58*cdf0e10cSrcweir oslSecurity SAL_CALL osl_getCurrentSecurity(void); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir /** Create a security handle for the denoted user. 61*cdf0e10cSrcweir Try to log in the user on the local system. 62*cdf0e10cSrcweir @param strzUserName [in] denotes the name of the user to logg in. 63*cdf0e10cSrcweir @param strPasswd [in] the password for this user. 64*cdf0e10cSrcweir @param pSecurity [out] returns the security handle if user could be logged in. 65*cdf0e10cSrcweir @return osl_Security_E_None if user could be logged in, otherwise an error-code. 66*cdf0e10cSrcweir @see osl_freeSecurityHandle 67*cdf0e10cSrcweir @see osl_executeProcess 68*cdf0e10cSrcweir @see osl_executeApplication 69*cdf0e10cSrcweir */ 70*cdf0e10cSrcweir oslSecurityError SAL_CALL osl_loginUser( 71*cdf0e10cSrcweir rtl_uString *strUserName, 72*cdf0e10cSrcweir rtl_uString *strPasswd, 73*cdf0e10cSrcweir oslSecurity *pSecurity 74*cdf0e10cSrcweir ); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir /** Create a security handle for the denoted user. 77*cdf0e10cSrcweir Try to log in the user on the denoted file server. On success the homedir will be 78*cdf0e10cSrcweir the maped drive on this server. 79*cdf0e10cSrcweir @param strUserName [in] denotes the name of the user to logg in. 80*cdf0e10cSrcweir @param strPasswd [in] the password for this user. 81*cdf0e10cSrcweir @param strFileServer [in] denotes the file server on wich the user is logged in. 82*cdf0e10cSrcweir @param pSecurity [out] returns the security handle if user could be logged in. 83*cdf0e10cSrcweir @return osl_Security_E_None if user could be logged in, otherwise an error-code. 84*cdf0e10cSrcweir @see osl_freeSecurityHandle 85*cdf0e10cSrcweir @see osl_executeProcess 86*cdf0e10cSrcweir @see osl_executeApplication 87*cdf0e10cSrcweir */ 88*cdf0e10cSrcweir oslSecurityError SAL_CALL osl_loginUserOnFileServer( 89*cdf0e10cSrcweir rtl_uString *strUserName, 90*cdf0e10cSrcweir rtl_uString *strPasswd, 91*cdf0e10cSrcweir rtl_uString *strFileServer, 92*cdf0e10cSrcweir oslSecurity *pSecurity 93*cdf0e10cSrcweir ); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /** Query if the user who is denotes by this security has administrator rigths. 96*cdf0e10cSrcweir @param Security [in] the security handle for th user. 97*cdf0e10cSrcweir @return True, if the user has adminsitrator rights, otherwise false. 98*cdf0e10cSrcweir */ 99*cdf0e10cSrcweir sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir /** Free the security handle, created by osl_loginUser or osl_getCurrentSecurity. 102*cdf0e10cSrcweir @param Security [in] the security handle. 103*cdf0e10cSrcweir @see osl_loginUser 104*cdf0e10cSrcweir */ 105*cdf0e10cSrcweir void SAL_CALL osl_freeSecurityHandle(oslSecurity Security); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir /** Get the login ident for the user of this security handle. 108*cdf0e10cSrcweir @param Security [in] the security handle. 109*cdf0e10cSrcweir @param strIdent [out] the string that receives the ident on success. 110*cdf0e10cSrcweir @return True, if the security handle is valid, otherwise False. 111*cdf0e10cSrcweir */ 112*cdf0e10cSrcweir sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir /** Get the login name for the user of this security handle. 115*cdf0e10cSrcweir @param Security [in] the security handle. 116*cdf0e10cSrcweir @param pszName [out] the string that receives the user name on success. 117*cdf0e10cSrcweir @return True, if the security handle is valid, otherwise False. 118*cdf0e10cSrcweir */ 119*cdf0e10cSrcweir sal_Bool SAL_CALL osl_getUserName(oslSecurity Security, rtl_uString **strName); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir /** Get the home directory of the user of this security handle. 122*cdf0e10cSrcweir @param Security [in] the security handle. 123*cdf0e10cSrcweir @param strDirectory [out] the string that receives the directory path on success. 124*cdf0e10cSrcweir @return True, if the security handle is valid, otherwise False. 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **strDirectory); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir /** Get the directory for configuration data of the user of this security handle. 129*cdf0e10cSrcweir @param Security [in] the security handle. 130*cdf0e10cSrcweir @param strDirectory [out] the string that receives the directory path on success. 131*cdf0e10cSrcweir @return True, if the security handle is valid, otherwise False. 132*cdf0e10cSrcweir */ 133*cdf0e10cSrcweir sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **strDirectory); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir /** Load Profile of the User 137*cdf0e10cSrcweir Implemented just for Windows 138*cdf0e10cSrcweir @param oslSecurity Security [in] previously fetch Security of the User 139*cdf0e10cSrcweir @return True if the Profile could successfully loaded, False otherwise. 140*cdf0e10cSrcweir */ 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /** Unload a User Profile 146*cdf0e10cSrcweir Implemented just for Windows 147*cdf0e10cSrcweir @param oslSecurity Security [in] previously fetch Security of the User 148*cdf0e10cSrcweir @return nothing is returned! 149*cdf0e10cSrcweir */ 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir void SAL_CALL osl_unloadUserProfile(oslSecurity Security); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir #ifdef __cplusplus 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir #endif 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir #endif /* _OSL_SECURITY_H_ */ 158*cdf0e10cSrcweir 159