cupsmgr.cxx (c82f2877) | cupsmgr.cxx (aa150a94) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 141 unchanged lines hidden (view full) --- 150 return pSym; 151} 152 153CUPSWrapper::CUPSWrapper() 154 : m_pLib( NULL ), 155 m_bPPDThreadRunning( false ) 156{ 157#ifdef ENABLE_CUPS | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 141 unchanged lines hidden (view full) --- 150 return pSym; 151} 152 153CUPSWrapper::CUPSWrapper() 154 : m_pLib( NULL ), 155 m_bPPDThreadRunning( false ) 156{ 157#ifdef ENABLE_CUPS |
158 OUString aLib( RTL_CONSTASCII_USTRINGPARAM( CUPS_LIB_NAME ) ); 159 m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); | 158 m_pLib = osl_loadAsciiModule( CUPS_LIB_NAME, SAL_LOADMODULE_LAZY ); |
160 if( ! m_pLib ) | 159 if( ! m_pLib ) |
161 { 162 aLib = OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "cups" ) ) ); 163 m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); 164 } | 160 m_pLib = osl_loadAsciiModule( "cups", SAL_LOADMODULE_LAZY ); |
165#endif 166 167 if( ! m_pLib ) 168 { 169#if OSL_DEBUG_LEVEL > 1 170 fprintf( stderr, "no cups library found\n" ); 171#endif 172 return; --- 958 unchanged lines hidden (view full) --- 1131 return (m_nDests && m_pDests && ! isCUPSDisabled())? false : PrinterInfoManager::addOrRemovePossible(); 1132} 1133 1134const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) 1135{ 1136 const char* pRet = NULL; 1137 1138#ifdef ENABLE_CUPS | 161#endif 162 163 if( ! m_pLib ) 164 { 165#if OSL_DEBUG_LEVEL > 1 166 fprintf( stderr, "no cups library found\n" ); 167#endif 168 return; --- 958 unchanged lines hidden (view full) --- 1127 return (m_nDests && m_pDests && ! isCUPSDisabled())? false : PrinterInfoManager::addOrRemovePossible(); 1128} 1129 1130const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) 1131{ 1132 const char* pRet = NULL; 1133 1134#ifdef ENABLE_CUPS |
1139 OUString aLib = OUString::createFromAscii( _XSALSET_LIBNAME ); 1140 oslModule pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); | 1135 oslModule pLib = osl_loadAsciiModule( _XSALSET_LIBNAME, SAL_LOADMODULE_LAZY ); |
1141 if( pLib ) 1142 { | 1136 if( pLib ) 1137 { |
1143 OUString aSym( RTL_CONSTASCII_USTRINGPARAM( "Sal_authenticateQuery" ) ); | |
1144 bool (*getpw)( const OString& rServer, OString& rUser, OString& rPw) = | 1138 bool (*getpw)( const OString& rServer, OString& rUser, OString& rPw) = |
1145 (bool(*)(const OString&,OString&,OString&))osl_getFunctionSymbol( pLib, aSym.pData ); | 1139 (bool(*)(const OString&,OString&,OString&))osl_getAsciiFunctionSymbol( pLib, "Sal_authenticateQuery" ); |
1146 if( getpw ) 1147 { 1148 osl::MutexGuard aGuard( m_aCUPSMutex ); 1149 1150 OString aUser = m_pCUPSWrapper->cupsUser(); 1151 OString aServer = m_pCUPSWrapper->cupsServer(); 1152 OString aPassword; 1153 if( getpw( aServer, aUser, aPassword ) ) 1154 { 1155 m_aPassword = aPassword; 1156 m_aUser = aUser; 1157 m_pCUPSWrapper->cupsSetUser( m_aUser.getStr() ); 1158 pRet = m_aPassword.getStr(); 1159 } 1160 } 1161 osl_unloadModule( pLib ); 1162 } 1163#if OSL_DEBUG_LEVEL > 1 | 1140 if( getpw ) 1141 { 1142 osl::MutexGuard aGuard( m_aCUPSMutex ); 1143 1144 OString aUser = m_pCUPSWrapper->cupsUser(); 1145 OString aServer = m_pCUPSWrapper->cupsServer(); 1146 OString aPassword; 1147 if( getpw( aServer, aUser, aPassword ) ) 1148 { 1149 m_aPassword = aPassword; 1150 m_aUser = aUser; 1151 m_pCUPSWrapper->cupsSetUser( m_aUser.getStr() ); 1152 pRet = m_aPassword.getStr(); 1153 } 1154 } 1155 osl_unloadModule( pLib ); 1156 } 1157#if OSL_DEBUG_LEVEL > 1 |
1164 else fprintf( stderr, "loading of module %s failed\n", OUStringToOString( aLib, osl_getThreadTextEncoding() ).getStr() ); | 1158 else fprintf( stderr, "loading of module %s failed\n", _XSALSET_LIBNAME ); |
1165#endif 1166#endif // ENABLE_CUPS 1167 1168 return pRet; 1169} | 1159#endif 1160#endif // ENABLE_CUPS 1161 1162 return pRet; 1163} |