Received: from biscayne-one-station.mit.edu (BISCAYNE-ONE-STATION.MIT.EDU [18.7.7.80]) by krbdev.mit.edu (8.9.3p2) with ESMTP id SAA21724; Tue, 28 Dec 2004 18:47:47 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by biscayne-one-station.mit.edu (8.12.4/8.9.2) with ESMTP id iBSNlkBL004457; Tue, 28 Dec 2004 18:47:46 -0500 (EST) Received: from [18.18.1.76] (KEN-WIRELESS.MIT.EDU [18.18.1.76]) (authenticated bits=0) (User authenticated as raeburn@ATHENA.MIT.EDU) by outgoing.mit.edu (8.12.4/8.12.4) with ESMTP id iBSNlh2d024674 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT); Tue, 28 Dec 2004 18:47:44 -0500 (EST) In-Reply-To: References: MIME-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Ken Raeburn , krb5-prs@mit.edu From: Ken Raeburn Subject: Re: [krbdev.mit.edu #2856] Need a function to clone krb5_context structs for thread safe apps Date: Tue, 28 Dec 2004 18:47:43 -0500 To: rt@krbdev.mit.edu X-Mailer: Apple Mail (2.619) X-Spam-Score: -4.9 X-Spam-Flag: NO X-Scanned-BY: MIMEDefang 2.42 RT-Send-Cc: X-RT-Original-Encoding: us-ascii Content-Length: 1230 On Dec 28, 2004, at 07:13, Ezra Peisach via RT wrote: > [jaltman@columbia.edu - Mon Dec 27 18:58:59 2004]: > My original intention with 2855 was to point out a potential race > condition - and the lack of locking. I do not feel that one needs > a separate context - unless one wants a different default realm for > each context... Note however, that krb5_parse_principal uses a static > default realm (retreived after krb5_get_default_realm) - which would > make it difficult.... Good point -- and since we're caching the value in the context anyways, there's no benefit in the one-context case. Might as well drop that cache. The restriction of using a krb5_context in only one thread at a time has been one of the basic assumptions practically since the thread-safety work was started. If we don't impose that restriction, then we have to add a mutex to the context, and lock it on basically every library call (except a few that don't use the context). I think the list of types we're currently expecting to be single-thread-at-a-time includes krb5_context, the auth context, the GSS context, and the simple types like krb5_principal that we're exposing and can't add a mutex to without changing the ABI. Ken