id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c24300
adjust expires time to utc if it's set if m.Expires != nil { utils.UTC(m.Expires) } return nil }
c24301
"cert_authorities", "cas": return KindCertAuthority, nil case "reverse_tunnels", "rts": return KindReverseTunnel, nil case "trusted_cluster", "tc", "cluster", "clusters": return KindTrustedCluster, nil case "cluster_authentication_preferences", "cap": return KindClusterAuthPreference, nil case "remote_clus...
c24302
:= walk(n.X) if err != nil { return nil, err } l = append(l, ret...) ret, err = walk(n.Sel) if err != nil { return nil, err } l = append(l, ret...) case *ast.Ident: return []string{n.Name}, nil case *ast.BasicLit: value, err := strconv.Unquote(n.Value) if err != nil { return nil, err ...
c24303
*cfg.UID, *cfg.GID) if err != nil { return nil, trace.ConvertSystemError(err) } err = os.Chown(sessionDir, *cfg.UID, *cfg.GID) if err != nil { return nil, trace.ConvertSystemError(err) } err = os.Chown(al.playbackDir, *cfg.UID, *cfg.GID) if err != nil { return nil, trace.ConvertSystemError(err) ...
c24304
return trace.BadParameter("missing parameter session ID") } if l.Namespace == "" { l.Namespace = defaults.Namespace } return nil }
c24305
i++ { fileNames[i] = idx.chunksFileName(i) } return fileNames }
c24306
if ok { return ctx, nil } ctx, cancel := context.WithCancel(context.TODO()) l.activeDownloads[path] = ctx return ctx, func() { cancel() l.Lock() defer l.Unlock() delete(l.activeDownloads, path) } }
c24307
} return nil, trace.Wrap(err) } data = append(data, out...) if len(data) == maxBytes || len(out) == 0 { return data, nil } maxBytes = maxBytes - len(out) offsetBytes = offsetBytes + len(out) } }
c24308
if l.ExternalLog != nil { emitAuditEvent = l.ExternalLog.EmitAuditEvent } else { emitAuditEvent = l.localLog.EmitAuditEvent } // Emit the event. If it fails for any reason a Prometheus counter is // incremented. err := emitAuditEvent(event, fields) if err != nil { auditFailedEmit.Inc() return trace.Wrap...
c24309
&e: return default: l.Warningf("Blocked on the events channel.") } }
c24310
trace.Wrap(err) } var out []string for _, serverID := range authServers { out = append(out, filepath.Join(l.DataDir, serverID)) } return out, nil }
c24311
!= nil { if err := l.localLog.Close(); err != nil { log.Warningf("Close failure: %v", err) } l.localLog = nil } return nil }
c24312
the percentage disk space used. auditDiskUsed.Set(usedPercent) // If used percentage goes above the alerting level, write to logs as well. if usedPercent > float64(defaults.DiskAlertThreshold) { log.Warnf("Free disk space for audit log is running low, %v%% of disk used.", usedPercent) } case <-l.ctx...
c24313
logrus.WithFields(logrus.Fields{ trace.Component: "backend:dir", trace.ComponentFields: logrus.Fields{ "dir": rootDir, }, }), } // DELETE IN: 2.8.0 // Migrate data to new flat keyspace backend. err = migrate(rootDir, bk) if err != nil { return nil, trace.Wrap(err) } return bk, nil }
c24314
keys, the keys are already sorted by GetItems. keys := make([]string, len(items)) for i, e := range items { keys[i] = e.Key } return keys, nil }
c24315
if strings.HasPrefix(pathToBucket, bucketPrefix) { matched = matched + 1 } } if matched > 0 { return nil, trace.BadParameter("%v is not a valid key", key) } return nil, trace.ConvertSystemError(err) } defer b.Close() // If the key does not exist, return trace.NotFound right away. item, ok := b.g...
c24316
{ return trace.CompareFailed("%v/%v did not match expected value", bucket, key) } if bk.isExpired(oldItem) { return trace.CompareFailed("%v/%v did not match expected value", bucket, key) } if bytes.Compare(oldItem.Value, prevVal) != 0 { return trace.CompareFailed("%v/%v did not match expected value", bucket,...
c24317
doesn't exist, return trace.NotFound. _, ok := b.getItem(key) if !ok { return trace.NotFound("key %v not found", key) } // Otherwise, delete key. b.deleteItem(key) return nil }
c24318
bucket) err := os.Remove(bk.flatten(fullBucket)) if err != nil { return trace.ConvertSystemError(err) } return nil }
c24319
break // success } if trace.IsAlreadyExists(err) { // locked? wait and repeat: bk.Clock().Sleep(250 * time.Millisecond) continue } return trace.ConvertSystemError(err) } return nil }
c24320
if !os.IsNotExist(err) { return trace.ConvertSystemError(err) } } return nil }
c24321
filepath.Join(bk.rootDir, bucket) }
c24322
nil, trace.Wrap(err) } return filepath.SplitList(decoded), nil }
c24323
{ return false } return bk.Clock().Now().After(bv.ExpiryTime) }
c24324
all items from the bucket. items, err := readBucket(file) if err != nil { return nil, trace.Wrap(err) } return &bucket{ backend: bk, items: items, file: file, }, nil }
c24325
} // The file is not empty, read it into a map. var items map[string]bucketItem bytes, err := ioutil.ReadAll(f) if err != nil { return nil, trace.ConvertSystemError(err) } err = utils.FastUnmarshal(bytes, &items) if err != nil { return nil, trace.Wrap(err) } return items, nil }
c24326
f.Truncate(0); err != nil { return trace.ConvertSystemError(err) } // Write out the contents to disk. n, err := f.Write(bytes) if err == nil && n < len(bytes) { return trace.Wrap(io.ErrShortWrite) } return nil }
c24327
if fi.Size() > 0 { return false, nil } return true, nil }
c24328
case *prefixItem: return !iother.Less(i) default: return false } }
c24329
bytes.HasPrefix(other.Key, p.prefix) { return false } return true }
c24330
Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, }, nil }
c24331
time.Time) { c.Status.LastHeartbeat = t }
c24332
r.Metadata.Name, r.Status.Connection) }
c24333
err = utils.UnmarshalWithSchema(GetRemoteClusterSchema(), &cluster, bytes) if err != nil { return nil, trace.BadParameter(err.Error()) } } err = cluster.CheckAndSetDefaults() if err != nil { return nil, trace.Wrap(err) } return &cluster, nil }
c24334
if !cfg.PreserveResourceID { // avoid modifying the original object // to prevent unexpected data races copy := *resource copy.SetResourceID(0) resource = &copy } return utils.FastMarshal(resource) default: return nil, trace.BadParameter("unrecognized resource version %T", c) } }
c24335
{ ca.Signer, err = ParsePrivateKeyPEM(keyPEM) if err != nil { return nil, trace.Wrap(err) } } return ca, nil }
c24336
subject.OrganizationalUnit = append([]string{}, id.Usage...) subject.Locality = append([]string{}, id.Principals...) subject.Province = append([]string{}, id.KubernetesGroups...) return subject }
c24337
subject.Locality, KubernetesGroups: subject.Province, } if err := i.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } return i, nil }
c24338
certs. BasicConstraintsValid: true, IsCA: false, } // sort out principals into DNS names and IP addresses for i := range req.DNSNames { if ip := net.ParseIP(req.DNSNames[i]); ip != nil { template.IPAddresses = append(template.IPAddresses, ip) } else { template.DNSNames = append(template.DNSNames, req...
c24339
if err != nil { ctx.Errorf("Exec request (%v) wait failed: %v", execRequest, err) } if result != nil { ctx.SendExecResult(*result) } // If this code is running on a Teleport node and PAM is enabled, close the context. if ctx.srv.Component() == teleport.ComponentNode { conf, err := t.SessionRegistr...
c24340
return trace.Wrap(err) } ctx.Debugf("Requested terminal %q of size %v", ptyRequest.Env, *params) // get an existing terminal or create a new one term := ctx.GetTerm() if term == nil { // a regular or forwarding terminal will be allocated term, err = NewTerminal(ctx) if err != nil { return trace.Wrap(e...
c24341
trace.Wrap(err) } if err := t.SessionRegistry.OpenSession(ch, req, ctx); err != nil { return trace.Wrap(err) } return nil }
c24342
// and to update their terminal windows accordingly. err = t.SessionRegistry.NotifyWinChange(*params, ctx) if err != nil { return trace.Wrap(err) } return nil }
c24343
instead of parameter list // this address is not used utils.NetAddr{Addr: "127.0.0.1:1", AddrNetwork: "tcp"}, srv, cfg.HostSigners, sshutils.AuthMethods{ PublicKey: srv.keyAuth, }, sshutils.SetLimiter(cfg.Limiter), sshutils.SetCiphers(cfg.Ciphers), sshutils.SetKEXAlgorithms(cfg.KEXAlgorithms), s...
c24344
s.Infof("Remote cluster %q has been deleted. Disconnecting it from the proxy.", cluster.GetName()) s.RemoveSite(cluster.GetName()) err := cluster.Close() if err != nil { s.Debugf("Failure closing cluster %q: %v.", cluster.GetName(), err) } } } return nil }
c24345
} for _, k := range keys { if sshutils.KeysEqual(k, auth) { return true } } return false }
c24346
for _, k := range keys { if sshutils.KeysEqual(k, auth) { return true } } return false }
c24347
authority with the signature key var match bool for _, k := range keys { if sshutils.KeysEqual(k, cert.SignatureKey) { match = true break } } if !match { return trace.NotFound("cluster %v has no matching CA keys", clusterName) } checker := utils.CertChecker{} if err := checker.CheckCert(user, cert)...
c24348
} for i := range s.localSites { if s.localSites[i].GetName() == name { return s.localSites[i], nil } } for i := range s.clusterPeers { if s.clusterPeers[i].GetName() == name { return s.clusterPeers[i], nil } } return nil, trace.NotFound("cluster %q is not found", name) }
c24349
to. accessPoint, err := srv.newAccessPoint(clt, []string{"reverse", domainName}) if err != nil { return nil, trace.Wrap(err) } remoteSite.remoteAccessPoint = accessPoint // instantiate a cache of host certificates for the forwarding server. the // certificate cache is created in each site (instead of creating...
c24350
startx, starty, err := GetCoordsFromCellIDString(parts[0]) if err != nil { return -1, -1, err } endx, endy, err := GetCoordsFromCellIDString(parts[1]) if err != nil { return -2, -2, err } return endx - startx, endy - starty, nil } } return 0, 0, nil }
c24351
// Cells that are stored as dates are not properly supported in this library. // They should instead be stored as a Numeric with a date format. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL] case CellTypeStringFormula: c.numFmt = builtInNumFmt[builtInNumFmtIndex_STRING] } }
c24352
continue //union , item can be ignored } else if dd.minRow >= item.minRow { //Split into three or two, Newly added object, intersect with the current object in the lower half tmpSplit := new(xlsxCellDataValidation) *tmpSplit = *item if dd.minRow > item.minRow { //header whetherneed to split item.m...
c24353
c.SetDataValidation(dd, start, -1) }
c24354
NewFile(), cellTypeToStyleIds: make(map[CellType]int), maxStyleId: initMaxStyleId, } }
c24355
nil { return nil, err } return NewStreamFileBuilder(file), nil }
c24356
that we use, we can assume that cell types // map one to one with Styles and their Style ID. // If a new cell type is used, a new style gets created with an increased id, if an existing cell type is // used, the pre-existing style will also be used. cellStyleIndex, ok = sb.cellTypeToStyleIds[*cellType] ...
c24357
{ sheet := sb.xlsxFile.Sheets[sheetIndex] column := sheet.Col(colIndex) column.SetDataValidationWithStart(validation, rowStartIndex) }
c24358
path, data := range parts { // If the part is a sheet, don't write it yet. We only want to write the XLSX metadata files, since at this // point the sheets are still empty. The sheet files will be written later as their rows come in. if strings.HasPrefix(path, sheetFilePathPrefix) { if err := sb.processEmptyS...
c24359
return err } // Split the sheet at the end of its SheetData tag so that more rows can be added inside. prefix, suffix, err := splitSheetIntoPrefixAndSuffix(data) if err != nil { return err } sf.sheetXmlPrefix[sheetIndex] = prefix sf.sheetXmlSuffix[sheetIndex] = suffix return nil }
c24360
endCoordinate } dataParts := strings.Split(data, fmt.Sprintf(dimensionTag, dimensionRef)) if len(dataParts) != 2 { return "", errors.New("unexpected Sheet XML: dimension tag not found") } return dataParts[0] + dataParts[1], nil }
c24361
errors.New("unexpected Sheet XML: SheetData close tag not found") } return sheetParts[0], sheetParts[1], nil }
c24362
} err := sf.write(cells) if err != nil { sf.err = err return err } return sf.zipWriter.Flush() }
c24363
1, } sheetPath := sheetFilePathPrefix + strconv.Itoa(sf.currentSheet.index) + sheetFilePathSuffix fileWriter, err := sf.zipWriter.Create(sheetPath) if err != nil { sf.err = err return err } sf.currentSheet.writer = fileWriter if err := sf.writeSheetStart(); err != nil { sf.err = err return err } ret...
c24364
return err } } // Write the end of the last sheet. if err := sf.writeSheetEnd(); err != nil { sf.err = err return err } } err := sf.zipWriter.Close() if err != nil { sf.err = err } return err }
c24365
sf.currentSheet.write(sf.sheetXmlPrefix[sf.currentSheet.index-1]) }
c24366
{ return err } return sf.currentSheet.write(sf.sheetXmlSuffix[sf.currentSheet.index-1]) }
c24367
{ fmt1 = "general" } if fmt2 == "" || strings.EqualFold(fmt2, "general") { fmt2 = "general" } return fmt1 == fmt2 }
c24368
This is an invalid format string, fall back to general return nil, errors.New("invalid format string, unmatched double quote") } i += endQuoteIndex + 1 } } return append(formats, format[prevIndex:]), nil }
c24369
case StyleWarning: strStyle = styleWarning case StyleInformation: strStyle = styleInformation } dd.ErrorStyle = &strStyle }
c24370
f2 { tmp := formula1 formula1 = formula2 formula2 = tmp } } dd.Formula1 = formula1 dd.Formula2 = formula2 dd.Type = convDataValidationType(t) dd.Operator = convDataValidationOperatior(o) return nil }
c24371
Fill: *DefaultFill(), Font: *DefaultFont(), } }
c24372
Color: xlsxColor{RGB: style.Border.LeftColor}, } xBorder.Right = xlsxLine{ Style: style.Border.Right, Color: xlsxColor{RGB: style.Border.RightColor}, } xBorder.Top = xlsxLine{ Style: style.Border.Top, Color: xlsxColor{RGB: style.Border.TopColor}, } xBorder.Bottom = xlsxLine{ Style: style.Border.Bottom...
c24373
formatColumnName(smooshBase26Slice(parts)) }
c24374
{ return GetCellIDStringFromCoordsWithFixed(x, y, false, false) }
c24375
if xFixed { xStr = fixedCellRefChar + xStr } yStr := RowIndexToString(y) if yFixed { yStr = fixedCellRefChar + yStr } return xStr + yStr }
c24376
return -1, -1, -1, -1, err } if x < minx { minx = x } if x > maxx { maxx = x } if y < miny { miny = y } if y > maxy { maxy = y } } } if minx == maxVal { minx = 0 } if miny == maxVal { miny = 0 } return }
c24377
} continue } upper++ } upper++ row.OutlineLevel = rawrow.OutlineLevel row.Cells = make([]*Cell, upper) for i := 0; i < upper; i++ { cell = new(Cell) cell.Value = "" row.Cells[i] = cell } return row }
c24378
strings.Trim(rawcell.Is.T, " \t\n\r") } else { for _, r := range rawcell.Is.R { cell.Value += r.T } } } }
c24379
{ defer close(sheetChan) err = nil for i, rawsheet := range workbookSheets { if err := readSheetFromFile(sheetChan, i, rawsheet, file, sheetXMLMap, rowLimit); err != nil { return } } }() for j := 0; j < sheetCount; j++ { sheet := <-sheetChan if sheet.Error != nil { return nil, nil, sheet.Er...
c24380
== "row" { rowCount++ if rowCount >= rowLimit { break } } } offset := decoder.InputOffset() output.Truncate(int(offset)) if readErr != io.EOF { _, err := output.Write([]byte(sheetEnding)) if err != nil { return nil, err } } return output, nil }
c24381
{ return nil, err } return f.ToSliceUnmerged() }
c24382
{ copy(s.Rows[index+1:], s.Rows[index:]) } s.Rows[index] = row if len(s.Rows) > s.MaxRow { s.MaxRow = len(s.Rows) } return row, nil }
c24383
} s.Rows = append(s.Rows[:index], s.Rows[index+1:]...) return nil }
c24384
cell := range merged { maincol, mainrow, _ := GetCoordsFromCellIDString(key) for rownum := 0; rownum <= cell.VMerge; rownum++ { for colnum := 0; colnum <= cell.HMerge; colnum++ { // make cell s.Cell(mainrow+rownum, maincol+colnum) } } } }
c24385
return t, err } return TimeFromExcelTime(f, date1904), nil }
c24386
0) c.SetDateTimeWithFormat(TimeToExcelTime(t.In(timeLocationUTC), c.date1904), options.ExcelTimeFormat) }
c24387
= builtInNumFmt[builtInNumFmtIndex_GENERAL] c.formula = "" c.cellType = CellTypeNumeric }
c24388
c.parsedNumFmt.numFmt != c.NumFmt { c.parsedNumFmt = parseFullNumberFormatString(c.NumFmt) } return c.parsedNumFmt }
c24389
return returnVal, *fullFormat.parseEncounteredError } return returnVal, err }
c24390
len(c.ClientIdentifier) > 65535 || len(c.Username) > 65535 || len(c.Password) > 65535 { //Bad size field return ErrProtocolViolation } if len(c.ClientIdentifier) == 0 && !c.CleanSession { //Bad client identifier return ErrRefusedIDRejected } return Accepted }
c24391
publish. store it in ibound // until puback sent s.Put(inboundKeyFromMID(m.Details().MessageID), m) default: ERROR.Println(STR, "Asked to persist an invalid messages type") } case 2: switch m.(type) { case *packets.PublishPacket: // Received a publish. store it in ibound // until pubrel receive...
c24392
o.ClientID = id return o }
c24393
o.CleanSession = clean return o }
c24394
{ o.Order = order return o }
c24395
Store) *ClientOptions { o.Store = s return o }
c24396
0x80) { o.ProtocolVersion = pv o.protocolVersionExplicit = true } return o }
c24397
{ o.OnConnect = onConn return o }
c24398
ConnectionLostHandler) *ClientOptions { o.OnConnectionLost = onLost return o }
c24399
o.WriteTimeout = t return o }