20 #include <e32std.h> |
20 #include <e32std.h> |
21 #include <e32uid.h> |
21 #include <e32uid.h> |
22 #include "clientutils.h" |
22 #include "clientutils.h" |
23 #include "fstokenservername.h" |
23 #include "fstokenservername.h" |
24 |
24 |
|
25 #ifdef SYMBIAN_AUTH_SERVER |
|
26 |
|
27 #ifdef __WINS__ |
|
28 #include <u32hal.h> |
|
29 #endif //__WINS__ |
|
30 |
|
31 #include <e32svr.h> |
|
32 #endif // SYMBIAN_AUTH_SERVER |
25 |
33 |
26 // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ |
34 // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ |
27 // Tokentype session class for file based certificate store |
35 // Tokentype session class for file based certificate store |
28 // Connects and passes messages to the file store tokentype server |
36 // Connects and passes messages to the file store tokentype server |
29 // Coded specifically for file store token type |
37 // Coded specifically for file store token type |
30 // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ |
38 // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ |
31 |
39 |
32 _LIT(KFSTokenServerImg,"fstokenserver"); |
40 _LIT(KFSTokenServerImg,"fstokenserver"); |
33 |
41 #ifdef SYMBIAN_AUTH_SERVER |
|
42 #ifdef __WINS__ |
|
43 _LIT(KFSNewTokenServerImg,"fstokenserver_useauth"); |
|
44 #endif // __WINS__ |
|
45 #endif // SYMBIAN_AUTH_SERVER |
34 |
46 |
35 RFileStoreClientSession::RFileStoreClientSession() |
47 RFileStoreClientSession::RFileStoreClientSession() |
36 {} |
48 {} |
37 |
49 |
38 TInt RFileStoreClientSession::SendRequest(TFSTokenMessages aRequest, const TIpcArgs& aArgs) const |
50 TInt RFileStoreClientSession::SendRequest(TFSTokenMessages aRequest, const TIpcArgs& aArgs) const |
59 static TInt StartServer(); // Forward declaration |
71 static TInt StartServer(); // Forward declaration |
60 // |
72 // |
61 // Connect to the server, attempting to start it if necessary |
73 // Connect to the server, attempting to start it if necessary |
62 // |
74 // |
63 |
75 |
|
76 #ifdef SYMBIAN_AUTH_SERVER |
|
77 #ifdef __WINS__ |
|
78 |
|
79 static bool UseAuthServer(void); |
|
80 |
|
81 #endif // SYMBIAN_AUTH_SERVER |
|
82 #endif // __WINS__ |
64 |
83 |
65 TInt RFileStoreClientSession::Connect(ETokenEnum aToken) |
84 TInt RFileStoreClientSession::Connect(ETokenEnum aToken) |
66 { |
85 { |
67 // The version is made up of three pieces of information: |
86 // The version is made up of three pieces of information: |
68 // 1. iMajor - The token we want to talk to |
87 // 1. iMajor - The token we want to talk to |
72 |
91 |
73 TInt retry=2; |
92 TInt retry=2; |
74 for (;;) |
93 for (;;) |
75 { |
94 { |
76 TInt err = KErrNone; |
95 TInt err = KErrNone; |
|
96 #ifdef SYMBIAN_AUTH_SERVER |
|
97 #ifdef __WINS__ |
|
98 if(UseAuthServer()) |
|
99 { |
|
100 err = CreateSession(KFSNewTokenServerName, version, 1); |
|
101 } |
|
102 else |
|
103 #endif // __WINS__ |
|
104 #endif // SYMBIAN_AUTH_SERVER |
77 { |
105 { |
78 err = CreateSession(KFSTokenServerName, version, 1); |
106 err = CreateSession(KFSTokenServerName, version, 1); |
79 } |
107 } |
80 |
108 |
81 if (err!=KErrNotFound && err!=KErrServerTerminated) |
109 if (err!=KErrNotFound && err!=KErrServerTerminated) |
86 if (err!=KErrNone && err!=KErrAlreadyExists) |
114 if (err!=KErrNone && err!=KErrAlreadyExists) |
87 return err; |
115 return err; |
88 } |
116 } |
89 } |
117 } |
90 |
118 |
|
119 #ifdef SYMBIAN_AUTH_SERVER |
|
120 #ifdef __WINS__ |
|
121 |
|
122 /*static*/ bool UseAuthServer(void) |
|
123 { |
|
124 bool useAuthServer = false; |
|
125 |
|
126 TUint32 useAuth = 0; |
|
127 // For the emulator allow the constant to be patched via epoc.ini |
|
128 UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalIntProperty, |
|
129 (TAny*)"KKeyStoreUseAuthServer", &useAuth); // read emulator property (if present) |
|
130 if(useAuth) |
|
131 { |
|
132 useAuthServer = true; |
|
133 } |
|
134 return useAuthServer; |
|
135 } |
|
136 #endif // __WINS__ |
|
137 #endif // SYMBIAN_AUTH_SERVER |
91 |
138 |
92 TInt StartServer() |
139 TInt StartServer() |
93 { |
140 { |
94 // Server startup is different for WINS in EKA1 mode ONLY (lack of process |
141 // Server startup is different for WINS in EKA1 mode ONLY (lack of process |
95 // emulation - we load the library in this instance |
142 // emulation - we load the library in this instance |
96 const TUidType serverUid(KNullUid, KNullUid, KUidFSTokenServer); |
143 const TUidType serverUid(KNullUid, KNullUid, KUidFSTokenServer); |
97 |
144 |
98 RProcess server; |
145 RProcess server; |
99 TInt error = KErrNone; |
146 TInt error = KErrNone; |
|
147 |
|
148 #ifdef SYMBIAN_AUTH_SERVER |
|
149 #ifdef __WINS__ |
|
150 if(UseAuthServer()) |
|
151 { |
|
152 error = server.Create(KFSNewTokenServerImg, KNullDesC, serverUid); |
|
153 } |
|
154 else |
|
155 #endif // __WINS__ |
|
156 #endif // SYMBIAN_AUTH_SERVER |
100 { |
157 { |
101 error = server.Create(KFSTokenServerImg, KNullDesC, serverUid); |
158 error = server.Create(KFSTokenServerImg, KNullDesC, serverUid); |
102 } |
159 } |
103 |
160 |
104 if (error != KErrNone) |
161 if (error != KErrNone) |