summaryrefslogtreecommitdiffstats
path: root/source4/scripting/wscript_build
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-09-15 14:57:59 +0200
committerAndrew Bartlett <abartlet@samba.org>2010-09-24 09:25:42 +1000
commitc03ec03212ff08b56710f1935caa6aa7f6cb529f (patch)
tree854b4eca203de8990c6b63b7f51973b68b687384 /source4/scripting/wscript_build
parentf46c6233e75509736f0c2a1c376ccab5c0f22fd2 (diff)
s4:ldap.py - test default primary groups on modify operations
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/wscript_build')
0 files changed, 0 insertions, 0 deletions
5 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
/*
 * (C) Copyright 2001
 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#if defined(VXWORKS)
# include <stdio.h>
# include <string.h>
# define CFG_DEF_EEPROM_ADDR 0xa0
extern char iicReadByte( char, char );
extern ulong_t crc32( unsigned char *, unsigned long );
#else
#include <common.h>
#endif

#include "vpd.h"

/*
 * vpd_reader() - reads VPD data from I2C EEPROMS.
 *                returns pointer to buffer or NULL.
 */
static unsigned char *
vpd_reader(unsigned char *buf, unsigned dev_addr, unsigned off, unsigned count)
{
    unsigned offset = off;			/* Calculated offset */

    /*
     * The main board EEPROM contains
     * SDRAM SPD in the first 128 bytes,
     * so skew the offset.
     */
    if (dev_addr == CFG_DEF_EEPROM_ADDR)
	offset += SDRAM_SPD_DATA_SIZE;

    /* Try to read the I2C EEPROM */
#if defined(VXWORKS)
    {
	int i;
	for( i = 0; i < count; ++i ) {
	    buf[ i ] = iicReadByte( dev_addr, offset+i );
	}
    }
#else
    if (eeprom_read(dev_addr, offset, buf, count)) {
	printf("Failed to read %d bytes from VPD EEPROM 0x%x @ 0x%x\n",
	       count, dev_addr, offset);
	return NULL;
    }
#endif

    return buf;
} /* vpd_reader() */


/*
 * vpd_get_packet() - returns next VPD packet or NULL.
 */
static vpd_packet_t *vpd_get_packet(vpd_packet_t *vpd_packet)
{
    vpd_packet_t *packet = vpd_packet;

    if (packet != NULL) {
	if (packet->identifier == VPD_PID_TERM)
	    return NULL;
	else
	    packet = (vpd_packet_t *)((char *)packet + packet->size + 2);
    }

    return packet;
} /* vpd_get_packet() */


/*
 * vpd_find_packet() - Locates and returns the specified
 *		       VPD packet or NULL on error.
 */
static vpd_packet_t *vpd_find_packet(vpd_t *vpd, unsigned char ident)
{
    vpd_packet_t *packet = (vpd_packet_t *)&vpd->packets;

    /* Guaranteed illegal */
    if (ident == VPD_PID_GI)
	return NULL;

    /* Scan tuples looking for a match */
    while ((packet->identifier != ident) &&
	   (packet->identifier != VPD_PID_TERM))
	packet = vpd_get_packet(packet);

    /* Did we find it? */
    if ((packet->identifier) && (packet->identifier != ident))
	return NULL;
    return packet;
}


/*
 * vpd_is_valid() - Validates contents of VPD data
 *		    in I2C EEPROM.  Returns 1 for
 *		    success or 0 for failure.
 */
static int vpd_is_valid(unsigned dev_addr, unsigned char *buf)
{
    unsigned	    num_bytes;
    vpd_packet_t    *packet;
    vpd_t	    *vpd = (vpd_t *)buf;
    unsigned short  stored_crc16, calc_crc16 = 0xffff;

    /* Check Eyecatcher */
    if (strncmp(vpd->header.eyecatcher, VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
	unsigned offset = 0;
	if (dev_addr == CFG_DEF_EEPROM_ADDR)
	    offset += SDRAM_SPD_DATA_SIZE;
	printf("Error: VPD EEPROM 0x%x corrupt @ 0x%x\n", dev_addr, offset);

	return 0;
    }

    /* Check Length */
    if (vpd->header.size> VPD_MAX_EEPROM_SIZE) {
	printf("Error: VPD EEPROM 0x%x contains bad size 0x%x\n",
	       dev_addr, vpd->header.size);